Erin81
New Member
- Joined
- Feb 22, 2021
- Messages
- 1
- Office Version
- 365
- 2019
- 2016
- 2010
- Platform
- 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:
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