General information
Category:
COM/DCOM and OLE Automation
>WHAT I WANT: (BUT DON'T KNOW AN EASY WAY TO ACCOMPLISH)
>
>What I would like is to do a little proactive programmatic checking for consistencies between the word document and the excel data. The names of the excel fields is a piece of cake since it is coming from the database, But I am not sure what the easiest way would be to get the merge fields names from the word document.
>
>If I could figure out a way to access the word document BEFORE I attempt to merge the data to see what fields it is expecting. The template is a normal word document at the point where I want to "read" the merge fields just prior to setting the datasource. Being a normal document object, I am not expecting that I will be able to find any document object properties that will help me out, but let me know if you know of one I don't.
>
>CURRENT PLAN:
>
>I have considered reading the word document as a text string and parsing out all the merge fields, I am just trying to think if there is any easier or faster way, currently this is my projected course of action.
>
You can open the Word document with Automation and cycle through the merge fields, using the MailMergeFields collection.
A better course of action, if you can control document creation, is to set up the document with the appropriate list of fields (using a MailMerge header source), so the user can pick the fields from the list of what will actually be available.
Tamar
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only