Maximising Word Window from Access

B

BarryM

In Access 97 I want to open some Word documents at the same time without
creating more than one instance of Word.

The following code works but I have been unable to maximise the Word window
(not the document window) using code in access. Any suggestions?

Many thanks in anticipation.

Public Sub GetGuidesDoc(strDoc As String)
On Error GoTo ErrDocs
Dim MyWord As Object

'Open Word
Set MyWord = GetObject(, "Word.Application") 'error if Word not running
OpenDoc:
'Open the selected document
MyWord.Documents.Open strDoc
MyWord.Application.Visible = True

Exit Sub
ErrDocs:
Select Case Err
Case 429 'ActiveX component can't create object
'Word not running, open it
Set MyWord = GetObject("", "Word.Application")
GoTo OpenDoc
Case Else
MsgBox "Error " & Err & ": " & Error, 0 + 64, "Opening Word Docs"
End Select
End Sub
 
G

Gerald Stanley

Try
MyWord.Application.WindowState = wdWindowStateMaximize
after
MyWord.Application.Visible = True

I noted that you dim'd MyWord as an object. Had you dim'd it as
Word.Application, then intellisense would help you.

Hope This Helps
Gerald Stanley MCSD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top