Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendKeys programming 1

Status
Not open for further replies.

marleymanner1

Programmer
Sep 16, 2008
2
US
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 think you want:

[tt]WordObj.ActiveDocument.ActiveWindow.WindowState = 1 'wdWindowStateMaximize[/tt]
 
thank you! I had worked with the window state before, but didn't use the corresponding integer because it was not stated in the help file. thank you again! problem solved...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top