Hi Veena,
thanks for the additional information
Have you actually tried whether your code retrieves the mergefield names
(? that's what you're after, right?) in the IncludeText area? In my
experience with Word, as long as the IncludeText result is displayed on
screen, those mergefields should be "visible". The following snippet
assumes I have only one field in the active doc, an IncludeText field.
If I query the fields in that fields range, I get all coming through
from the linked file, and can address them as if they were in the active
doc
Dim rng As Word.Range
Set rng = ActiveDocument.Fields(1).Result
Debug.Print rng.Fields(1).Code
I am using Word 2000 and programmatically performing the mail merge
using VB. My program includes a logic, where all the mergefields,
present in abc.doc have to be compared with the datasource's fields.
In case there is a mismatch between the datasource and the doc file ,
insteading of mailmerge producing an error, an application should
throw the error.
Well, the actual problem is that, to achieve the above I need ALL the
mergefields in the document used for merging including those in the
include text. The mergefields present in document abc i can get by
WordApplication.ActiveDocument.MailMerge.Fields but how do i get the
merge fields of xyz.doc??
{ I am using the template abc.doc which includes another document in
the
form
INCLUDETEXT "c:\\include\\xyz.doc"
}
The workaround would be to retrieve all the mergefields in abc.doc,
check for the ones with the word INCLUDETEXT, then open them using
word, and retrieve their mergefields and then combine all the
mergefields in a MailMergeFields collection object and then use it for
my logic.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
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
