Link to home
Start Free TrialLog in
Avatar of Clif
ClifFlag for United States of America

asked on

Mail Merge with Form Data

Writing in Word 2010 for users who are running Word 2003

I have a Mail Merge document that's working well, pulling data out of the database and placing it where it needs to be.

Now I need to ask the user a couple of questions and place some text in certain places where it needs to be depending on the answer.  To that end, I have created a form with two combo boxes listing all the available choices and an OK button.  The user makes a selection, clicks OK and ...

Now what?

I know the values I want entered, but what's the code to move them from the btnOK_Click event to the doc file?

I was hoping the values would appear as variables that I could drop in like I am currently doing with mail merge fields.

How Do I?

TIA
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

The main problem in adding data to a document is knowing where to put it.

One way is to use a bookmark:

ActiveDocument.Bookmarks("MyBookmark").Range.Text = cboQuestion1.Text
However I am not sure that the approach is suitable for use with mail merge.

Not that you can use an ASK field to allow the user to add some text to each record's output during a mail merge.
Oops.

"Not that you can ..."
should read:
"Note that you can ..."
Avatar of Clif

ASKER

I thought about using "Ask", but I need it to be in the form of a combobox (ie, a specific number of selections and no mis-spellings).  And, it looked like (from my research) that "Ask" was only available in Word 2010 (and possible 2007).

I tried the bookmark, and it does sort of work in that text is inserted in the document where I need it to go (just like my previous question, I am putting the data in a textbox on the document so that it doesn't move the existing text during an insert.  The biggest issue, though, is, that there is no way to "clear" the bookmark items so the user would have to close Word and restart it for each document.
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Clif

ASKER

Perfect.  Thanks.