Maximizing Word - Compile Error (1 Viewer)

meandmyhorse

New member
Local time
Today, 16:02
Joined
Jul 31, 2002
Messages
6
Help on Maximizing Word

Two things....here is another options for those struggling to make Access launch Word and do a mail merge. Of all the samples listed on this board, I couldn't get them to work (green VBA'er here), but this one works!! Yeah!! I created a query so that only the current record is available, then on the click of a button it opens word and merges the current record with the word file.

The only downfall on this is that I can't get Word to maximize, it stays minimized on the bottom of my screen. I added
objWord.Application.WindowState = wdWindowStateMaximize, but I get a compile error that says variable not defined and points to the "wdWindowStateMaximize" - any help would be appreciated.

Private Sub cmdTest_Click()
Dim objWord As Object
Set objWord = GetObject("d:\data\independent contract.doc", "word.Document")
objWord.Application.Visible = True
objWord.Application.WindowState = wdWindowStateMaximize
With objWord
.Mailmerge.execute
End With
End Sub
 

RichMorrison

Registered User.
Local time
Today, 10:02
Joined
Apr 24, 2002
Messages
588
you wrote
<<
but I get a compile error that says variable not defined and points to the "wdWindowStateMaximize" - any help would be appreciated.
>>

The error means just what it says.

The compiler can't find a Constant for wdWindowStateMaximize so the compiler assumes it is an undefined variable.

RichM
 

meandmyhorse

New member
Local time
Today, 16:02
Joined
Jul 31, 2002
Messages
6
So how do I fix it so that it opens word is the max state?
 

Users who are viewing this thread

Top Bottom