The following code executes without error, and opens the word file. Problem is it doesn't actually go to the bookmarked location specified, but stays on the initial view at beginning of document. I don't do much with Word, and am a little clueless here. Can someone show me the error of my ways?
Private Sub cmdGuide_Click() Dim wrdApp As Object Dim wrdDoc As Object Dim myFile As String myFile = "D:\Data\User Guide.docx" Set wrdApp = CreateObject("Word.Application") wrdApp.Visible = True Set wrdDoc = wrdApp.Documents.Open(myFile) wrdDoc.Goto What:=wdGoToBookmark, Name:="Census" Set wrdApp = Nothing Set wrdDoc = Nothing End Sub
I also tried (instead of the wrdDoc.Goto statement):