PDA

View Full Version : Move cursor to bookmark after Word document has been merged via external program



Liagua
04-05-2017, 03:33 AM
Hello,

What do I have to do to get a macro to run after a Word document has been merged?

The Merge is happening inside of the Word Application(local .dotm file), but merging data comes by another (external) application.

After the data is merged (local .dotm file has e new name.docx) I would like to have the cursor moved to a bookmark like so

If ActiveDocument.Bookmarks.Exists("BOOKMARK") = True Then
Selection.GoTo What:=wdGoToBookmark, Name:="BOOKMARK"
Else
End If

- running Word 2007


How can I get the Macro to run after a merge?

If you need any other info please let me know




Regards
Ronald

macropod
04-05-2017, 04:25 PM
To do that, your other application would have to do the automation. That said, there shouldn't be any need to four own code to select anything. Moreover, mailmerge output documents don't contain any bookmarks, so any Bookmarks.Exists test on one that you haven't subsequently added the bookmark to will always return False.