I am using Excel VBA to populate bookmarks in Word. I also want to update a bookmark in the footer of the document. Whenever the bookmark is not in the footer, my code works fine. However, when the bookmark in the footer should be populated, I get a Run-time error '5678' Word cannot find the requested bookmark.
.
I tried recording the code in Word, which gives me the following:
Selection.Goto What:=wdGoToBookmark, Name:=Bookmarkname
Since I am working from Excel I have changed this code to, where wordobject = CreateObject("Word.Application")
:
wordobject.Selection.Goto What:=wdGoToBookmark, Name:=Bookmarkname
As stated above, this code works fine when the bookmark is in the 'normal' text. Whenever the bookmark is in the footer, it throws the error.
How can I populate bookmarks in the footer of the Word-document?