I have a Excel sheet filled with data. I copy some of this data by Mail merge to a Word document.
Then, I save this merged documents one by one. The name of the saved document is composed by some data from the Merged fields like:
lblDocName = ActiveDocument.Fields(60).Result
No problem so far.
Sometimes the index number is change as example from 60 to 59. This can happen when I transfer the documents to another computer.
How can i use the field name instead of the index number?
I have tried:
lblDocName = ActiveDocument.Fields("DocName").Result
But, the field content looks like this: " MERGEFIELD "DocName"
Sorry for my English skills.
Rob
Then, I save this merged documents one by one. The name of the saved document is composed by some data from the Merged fields like:
lblDocName = ActiveDocument.Fields(60).Result
No problem so far.
Sometimes the index number is change as example from 60 to 59. This can happen when I transfer the documents to another computer.
How can i use the field name instead of the index number?
I have tried:
lblDocName = ActiveDocument.Fields("DocName").Result
But, the field content looks like this: " MERGEFIELD "DocName"
Sorry for my English skills.
Rob