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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximizing Word within Access

Status
Not open for further replies.

ormsk

Programmer
Sep 30, 2002
147
GB
Hi

I have created a small app that opens a Word Document. My problem is that Word is placed on the taskbar minimized. I have to right-click and select the maximize option to view.

I cannot find the right syntax to 'maximize' Word.

Any suggestions?
 
Please provide the code you used to open word, then we can advis you from there.

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
I use something along these lines - the function takes one string parameter which is the full path of the file you want to open.

Code:
Function fctnOpenDoc(strDoc as string)
On Error GoTo Err_fctnOpenDoc
    DoCmd.Hourglass True
    Dim RetVal
    RetVal = Shell("winword '" & strDoc & "'", vbNormalFocus)
    
Exit_fctnOpenDoc:
    DoCmd.Hourglass False
    Exit Function
    
Err_fctnOpenDoc:
    If Err.Number = 2475 Then
        Resume Next
    Else
        MsgBox Err.Number & ": " & Err.Description
        Resume Exit_fctnOpenDoc
    End If
    
End Function
[pc2]
 
I would suggest creating an object and referencing ms word, then you can control many aspects of the program and every thing...

Look under references and look for microsoft word...

then set an object some thing like this...

dim app as word.application
dim doc as word.document

set doc = "c:\whatever.doc"

now this is not real code, i'm just typing that to give you an idea the way to go...

when you reference word, check to see the objects you can work with...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Ormsk,

Junior1544 is right.

There are many "app." selections that will help you
control Word.


Set app = CreateObject("word.Application")
app.Visible = True
app.Documents.Open (Me.FileName)
app.Quit

hth,
Wayne
 
My code to date

Dim wordApp As Word.Application
Dim wordDoc As Word.Document

Set wordApp = CreateObject("Word.Application")

With wordApp
.Documents.Open strFilename, ReadOnly:=True
.Visible = True
.ActiveDocument.PrintPreview
End With

wordApp.Activate
Set WordApp = Nothing

This works OK, it opens up Word, Opens the document, but the application is minimized. I want it to be maximized.

I was expecting to be able to use wordApp.Maximized or something like that, but I no data member exists.

Thx
 
Found the answer!

I had been trying to use the WindowState property, but had no success.

However, I was using the WindowState property of the ActiveWindow

e.g.
ActiveWindow.WindowState = wdWindowStateMaximize

When I applied it to the Application object

WordApp.WindowState = wdWindowStateMaximize

It works!

Many thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top