A
Abraet
I have a mail merge file that I now want to read as input to find a customer
number and then look up more info on that customer to determine if the merged
document should be printed, faxed or emailed depending on the customer's
preference. I can read a bookmark field from Word fine, but it doesn't seem
to keep the bookmark from the master document when creating the word
document. Now I'm trying to use the find property to find a text word label
then calculate the location of the data relative to the label, but not sure
I'm going about it right. Here's my starter code. Any suggestions??
MSWord.Documents.Open(CurrentFile)
MSWord.Activate
Selection.WholeStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "CustNbr"
End With
Selection.Find.Execute
' look for "Cust Number " then add 13 to get to start of data.
CustNbrFieldBeginRange = Selection.Range.start + 13
' Cust number is 9 characters so end at
CustNbrFieldEndRange = CustNbrFieldBeginRange + 9
Set
CustNbr = **Here I'm not sure how to reference new range to pick up value
of data from calculated range ***
Call MSWord.ActiveDocument.Close
number and then look up more info on that customer to determine if the merged
document should be printed, faxed or emailed depending on the customer's
preference. I can read a bookmark field from Word fine, but it doesn't seem
to keep the bookmark from the master document when creating the word
document. Now I'm trying to use the find property to find a text word label
then calculate the location of the data relative to the label, but not sure
I'm going about it right. Here's my starter code. Any suggestions??
MSWord.Documents.Open(CurrentFile)
MSWord.Activate
Selection.WholeStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "CustNbr"
End With
Selection.Find.Execute
' look for "Cust Number " then add 13 to get to start of data.
CustNbrFieldBeginRange = Selection.Range.start + 13
' Cust number is 9 characters so end at
CustNbrFieldEndRange = CustNbrFieldBeginRange + 9
Set
CustNbr = **Here I'm not sure how to reference new range to pick up value
of data from calculated range ***
Call MSWord.ActiveDocument.Close