How to jump to top of word document's selected bookmark?

Erin81

New Member
Joined
Feb 22, 2021
Messages
1
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
Hello all,
I am creating an Excel flowchart with buttons for each step that when clicked, open a Word doc with instructions. I've bookmarked each step in the Word doc and the code works to bring the user there, however I would like for the selected bookmark to appear at the top of the page, and currently it is displaying towards the bottom which will confuse my users. I've not done any VBA with Word so I have no experience here, and would appreciate any help you can give! I've attached a screenshot of what it looks like right now, and as you can see, Step 4 is selected, but not at the top of the page.

Here's my code so far:

VBA Code:
Sub OpenWordDocument(strTopic)

    Dim strPath As String
   
    strPath = "L:\Do Not Move, Erase, or Rename!\Steps_CaseEntryProcess.docx"
   
    Dim objWord As Object
   
    Dim docWord As Object
   
    On Error Resume Next 'If Word is already running
   
    Set objWord = CreateObject("Word.Application")
   
    objWord.Visible = True
   
    Set docWord = objWord.Documents.Open(Filename:=strPath, ReadOnly:=True) 'Open Word document
   
    objWord.Activate
   
    docWord.Bookmarks(strTopic).Range.Select 'Bring user to selected bookmark
 

End Sub

VBAscreenshot_WordDoc.PNG
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,215,429
Messages
6,124,839
Members
449,193
Latest member
MikeVol

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top