merge fields in the include text.

V

Veena

Hi,

I am using the template abc.doc which includes another document in the
form
INCLUDETEXT "c:\\include\\xyz"

"mobjWord.ActiveDocument.MailMerge.Fields" gives me the merge fields
present in abc.doc. How do i retreive the merge fields in xyz.doc,
without opening it in word.
I mean how can include xyz.doc 's merge field names, directly.

Any help would be greatly appreciated.

- Regards,
Veena.
 
C

Cindy M -WordMVP-

Hi Veena,
I am using the template abc.doc which includes another document in the
form
INCLUDETEXT "c:\\include\\xyz"

"mobjWord.ActiveDocument.MailMerge.Fields" gives me the merge fields
present in abc.doc. How do i retreive the merge fields in xyz.doc,
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 :)
 
V

Veena

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.
 
V

Veena

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.
 
C

Cindy M -WordMVP-

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 :)
 

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