Hi Veena,
> I am using the template abc.doc which includes another document in the
> form
[quoted text clipped - 4 lines]
> without opening it in word.
> I mean how can include xyz.doc 's merge field names, directly.
I'm afraid you can't access the content of xyz.doc without opening it in
Word. The only exception: if this were Word 2003 and it had been saved
in WordML format (XML), then you could use XPath on it.
Note: I can't figure out exactly what it is you're trying to do. Perhaps
if you explain in a bit more detai, we can make a suggestion or two.
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 :-)
Veena - 22 Apr 2004 10:47 GMT
Thanks for the reponse Cindy!!
let me explain the problem in detail.
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.
Any comments would be very helpful,
Regards,
Veena.
> Hi Veena,
>
[quoted text clipped - 21 lines]
> This reply is posted in the Newsgroup; please post any follow question
> or reply in the newsgroup and not by e-mail :-)
Veena - 22 Apr 2004 10:50 GMT
Thanks for the reponse Cindy!!
let me explain the problem in detail.
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.
Any comments would be very helpful,
Regards,
Veena.
> Hi Veena,
>
[quoted text clipped - 21 lines]
> This reply is posted in the Newsgroup; please post any follow question
> or reply in the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 22 Apr 2004 17:59 GMT
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,
[quoted text clipped - 19 lines]
> 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 :-)