marleymanner1
Programmer
Hello all,
I am new to the forum. Have a quick question for you experts...
I am using an Access module to open a word document using the following code:
Private Sub Label35_Click()
On Error Resume Next
Dim WordObj As Object
Dim WordDoc As Object
Dim WordRange As Object
Set WordObj = CreateObject("Word.Application")
Set WordDoc = WordObj.Documents.Open _
("C:\Letters\0AMPMike.doc")
WordObj.Visible = True
WordObj.Activate
WordDoc.Activate
Set WordRange = WordDoc.Goto(What:=wdGoToBookmark, Name:="a7")
WordDoc.Bookmarks("a7").Select
End Sub
This opens the document as a window on top of the other windows. The last thing I want to do now is maximize the Word document window, as I have it set to open as non-maximized (on purpose, for this test alone). I tried using the following code after the ACTIVATE lines:
WordObj.SendKeys "%({ }x)"
but I don't think that is valid because the SENDKEYS statement is not associated with DOT notation in the Word help article. It is just stand alone. I have searched the internet high and low for this line of code to maximize the window, but have come up empty. I would appreciate any help I can get on completing the line and making it work. Thank you so much!
I am new to the forum. Have a quick question for you experts...
I am using an Access module to open a word document using the following code:
Private Sub Label35_Click()
On Error Resume Next
Dim WordObj As Object
Dim WordDoc As Object
Dim WordRange As Object
Set WordObj = CreateObject("Word.Application")
Set WordDoc = WordObj.Documents.Open _
("C:\Letters\0AMPMike.doc")
WordObj.Visible = True
WordObj.Activate
WordDoc.Activate
Set WordRange = WordDoc.Goto(What:=wdGoToBookmark, Name:="a7")
WordDoc.Bookmarks("a7").Select
End Sub
This opens the document as a window on top of the other windows. The last thing I want to do now is maximize the Word document window, as I have it set to open as non-maximized (on purpose, for this test alone). I tried using the following code after the ACTIVATE lines:
WordObj.SendKeys "%({ }x)"
but I don't think that is valid because the SENDKEYS statement is not associated with DOT notation in the Word help article. It is just stand alone. I have searched the internet high and low for this line of code to maximize the window, but have come up empty. I would appreciate any help I can get on completing the line and making it work. Thank you so much!