MergeFields Count (TextBox)

C

Craig Jones

Hi,
I have a macro that searches through a document for MergeFields, storing the
fieldnames in an array. I first switch on fieldcodes view, and view page
header/footer before searching - this seems to work fine.

My problem is that when textboxes have MergeFields in them, they are not
found. Even when I use the command:
ActiveDocument.MailMerge.Fields.Count it doesn't include them.

Any help would be greatly appreciated.

Regards
 
C

Cindy M -WordMVP-

Hi Craig,

The problem is that text boxes are located in the "Drawing layer" of the
document, and much of Word's built-in functionality doesn't recognize anything
in this layer.

Best would probably be to convert the text boxes into Frames (Textbox tab of
the Format text box dialog box).

If you can't do this for some reason (linked text boxes, for example) then
you'll need to look at the articles on using Find on the word.mvps.org
website. When using a macro to "Find", you need to loop through the relevant
document "stories".
I have a macro that searches through a document for MergeFields, storing the
fieldnames in an array. I first switch on fieldcodes view, and view page
header/footer before searching - this seems to work fine.

My problem is that when textboxes have MergeFields in them, they are not
found. Even when I use the command:
ActiveDocument.MailMerge.Fields.Count it doesn't include them.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Craig Jones

Thank you very much for your help Cindy, StoryRanges has indeed done the
trick.

Regards

Craig
 

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