Reputation: 59
I am using excel VBA to populate data onto a word template from an excel spreadsheet. The problem I am having is selecting the top of the word document so the information goes into the right spot.
I have tried using Selection.HomeKey wd:=Story
and Selection.MoveUp Unit:=wdScreen, count:=1
both with no success as I am consistently getting
runtime error 4120
Upvotes: 3
Views: 2174
Reputation: 7409
Please try
ActiveDocument.Bookmarks("\StartOfDoc").Select
It makes use of a pre-defined, implicit bookmark to take you to the beginning of the document.
I just tested in Word 2016 and it works.
Upvotes: 4