• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

VBA/OLE: Maximize Word97 from within Access97

I use the following VBA-code to try to display and maximize Word 97 from within Access 97. Word shows up but isn't maximized. Why ?
My customer also complains that Word starts but does not pop up in front. So they need to click it to front. Has anyone solved these problems ?

Set wrd = CreateObject("Word.Application.8")
<...>
wrd.Visible = True
If wrd.Application.WindowState <> wdWindowStateMaximize Then wrd.Application.WindowState = wdWindowStateMaximize
0
BBC
Asked:
BBC
  • 2
1 Solution
 
tureCommented:
BBC,

My first guess is that the constant wdWindowStateMaximize isn't assigned properly. It's value should be 1. Try using the value 1 instead of the constant.
Also... you don't need to use wrd.Application.WindowState. wrd IS already an application object so wrd.WindowState is good enough.

Try this code. It worked well for me.

  Dim wrd As Word.Application
  Set wrd = CreateObject("Word.Application.8")
  wrd.Visible = True
  If wrd.WindowState <> 1 Then wrd.WindowState = 1

Ture Magnusson
Karlstad, Sweden
0
 
BBCAuthor Commented:
Uhh... I hate magic constants. But this thing is MESSED UP (MS Office).
Your suggestion works, so I'll use it. Thanks.
Did you ever try:

 if wrd.WindowState <> 1 Then wrd.WindowState = 1
wrd.Visible = True

You get a different result. You get Word without Word ... ;-)

PS: Submit it as answer and you'll get the points.
0
 
tureCommented:
BBC,

I'm glad that I could help you.

* PAQ Readers: Please see my previously posted comment for a solution ***

Ture Magnusson
Karlstad, Sweden
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now