Forum Discussion
Storming
May 05, 2020Brass Contributor
Opening a Word document from within Access
I am trying to open a Word document containing the user manual at different bookmarks depending on which form the user is on.
I have the following code:-
Private Sub Command35_Click()
Dim strPath As String
strPath = "C:\Users\norma\Desktop\Phili CCC business management system user manual.docx"
Dim objWord As Object
Dim docWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set docWord = objWord.Documents.Open(FileName:=strPath, ReadOnly:=True)
docWord.Bookmarks("MainMenu").Select
objWord.Activate
WindowState = wdWindowStateMaximised
End Sub
The Word document opens fine but I can not get it to be maximised.
The other problem is that the Word document opens at the bookmark but the bookmark is at the bottom of the maximised screen showing half of the previous page above it. See attachment.
Any idea how to resolve that please so that the bookmark starts at the top of the page?
I have the following code:-
Private Sub Command35_Click()
Dim strPath As String
strPath = "C:\Users\norma\Desktop\Phili CCC business management system user manual.docx"
Dim objWord As Object
Dim docWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set docWord = objWord.Documents.Open(FileName:=strPath, ReadOnly:=True)
docWord.Bookmarks("MainMenu").Select
objWord.Activate
WindowState = wdWindowStateMaximised
End Sub
The Word document opens fine but I can not get it to be maximised.
The other problem is that the Word document opens at the bookmark but the bookmark is at the bottom of the maximised screen showing half of the previous page above it. See attachment.
Any idea how to resolve that please so that the bookmark starts at the top of the page?
No RepliesBe the first to reply