Prob with automating MS Word

L

Larry

I'm running into a problem automating Word from an
Access '97 application in XP (this problem doesn't occur
in NT). My code creates a word object, opens an existing
word template, fills in bookmarks, saves the document, and
then tries to set the focus to the word document.
However, the Word session just flashes on the Start Bar
and doesn't receive the focus. Any ideas?
 
A

Alexander

What is the option when you declare/open word as object?
Something as 'Maximized' or 'vbMaximized' is used?

Alex
 
L

Larry

Thanks for responding!

I save the document and then pop up a msgbox telling the
user the name of the document that was created. After he
clicks OK, my code says:
objword.visible = true
objword.activate

I dont specify vbMaximized. This works as is in NT but
not on XP.

Also, I tried removing the msgbox. This seems to work if
Word has not yet been opened - the window receives the
focus. However, if Word is already opened and I generate
another document, I get the same flashing session on the
Start bar.
 
C

Chris

Hi Larry,
When you set the objword object, do you use late
binding? I have read that this can reduce problems with
different versions of Word.

Also you could look at trying getObject to get the
instance of Word if it is running, and only call
createObject if that produces an error(when no instance is
already running).

HTH

Regards
Chris
 

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