Insert Line In DocVariable

K

Kevin R

Is it possible to insert a new line or paragraph within the DOCVARIABLE
itself? For example, I want the following to check to see if something is
entered for "Position" on the user form. If so, then insert a carriage
return in the document then the contents of Position.

{ IF {DOCVARIABLE "Position" } <> "" INSERT NEW LINE "{ DOCVARIABLE
"Position" }" }

I want it to check the docvariable first to eliminate any unnecessary blank
lines in the document. I could do this in the vba code but I will use this
docvariable multiple times and don't always want a carriage return to proceed
it. Thanks.
 
D

Doug Robbins - Word MVP

If you try to make use of a document variable that has a null value, you
will get an "Error! No document variable supplied." in your document.

Better to build a String that contains the data from that section of your
form with the necessary carriage returns in it and then insert that string
into just one document variable.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top