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
LVL 1
BBCAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.