Share via

Stop the "Error No Document Variable Supplied Message" if no information provided

Anonymous
2012-03-20T00:39:40+00:00

I have many templates that use docvariables from a userform, but some fields return with 'Error No Document Varied Supplied' when the document is generated.  This is actually expected, however, I'm just wondering if there's a way to simply stop this message from appearing altogether.  I just end up deleting the field in my template when the item doesn't exist.  From time to time, the variable does exist and will be entered into my userform and this message won't appear, but sometimes the information does not exist and I'd like to not have to delete the error message and field if the item doesn't exist.

Thanks!

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2012-03-20T11:21:20+00:00

I have many templates that use docvariables from a userform, but some fields return with 'Error No Document Varied Supplied' when the document is generated.  This is actually expected, however, I'm just wondering if there's a way to simply stop this message from appearing altogether.  I just end up deleting the field in my template when the item doesn't exist.  From time to time, the variable does exist and will be entered into my userform and this message won't appear, but sometimes the information does not exist and I'd like to not have to delete the error message and field if the item doesn't exist.

 

Thanks!

You need to use an If.. End If construction in the code behind the userform to test for data for the variable and if there is non, then set the variable to " " (a space).

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-03-20T11:36:56+00:00

    Answer clarification for other readers:

    The field code will look like the below:

     { If { Docvariable Name1 } = "Error! No document variable supplied." "" { Docvariable Name1} }

    Was this answer helpful?

    0 comments No comments