Populating Merge Fields programmically

R

rjjhome

I have a VB.net app that opens a Word document and must populate several
<<MergeFields>> based on user input from the VB app. How do I get the
collection of fields in the Word document and select a field based on the
fields names so I know which one I am updating?
 
D

Doug Robbins - Word MVP

Instead of using mergefields, I would use { DOCVARIABLE varname } fields and
then I would have the VB.net app populate the values of those variables and
then update the fields in the document so that the DOCVARIABLE fields
displayed the values of the variables.

--
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
 
M

macropod

Hi rjjhome,

That's not how mergefields are used, unless your code merely identifies the record to be merged from the datasource, then executes
the merge to populate the mergefields for that record. Otherwise, your code would have to replace the mergefields with the required
data.
 

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