retrieving the mergefield list...

B

Bernie

Hello, dear group.
For my first post, i have a great question : i'd like to know if it'
possible to retrieve the list of all the merge fields of a document
and store it in a flat file.

I think to write a macro which will be executed when the user saves th
document.

The document will have from 0 to n fields, depending on the user'
context, so the dimension of the list is not fixed.

Oh, just one thing : i'm a java, C, perl programmer. But with V
macros, i'm an absolute beginner...

Thanks in advance for your help, and please excuse my poor english
 
D

Doug Robbins - Word MVP

You should be able to mould this into doing what you want:

Dim mf As Variant
For Each mf In ActiveDocument.MailMerge.DataSource.FieldNames
ActiveDocument.Range.InsertAfter mf & vbCr
Next mf


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
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