Word Activation - Late Bound

D

Derek Hart

I am opening Word from other vba programs, Excel, Access, etc... I cannot
get it to load with focus. It worked perfectly in Word 2003, but Word 2007
stays in the background when opening.

I am using:

objWord.Visible = True
objWord.Activate
objWord.WindowState = 1 'maximized

Any suggestions?
 
C

Cindy M.

Hi Derek,
I am opening Word from other vba programs, Excel, Access, etc... I cannot
get it to load with focus. It worked perfectly in Word 2003, but Word 2007
stays in the background when opening.

I am using:

objWord.Visible = True
objWord.Activate
objWord.WindowState = 1 'maximized
If you have a document open, try activating the document.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
D

Derek Hart

Tried that. Did not work. Any other thoughts? Here is what I am doing:

Dim objWrdDoc As Object
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
Set objWrdDoc = objWord.Documents.Open(FileToOpen)
objWrdDoc.MailMerge.MainDocumentType = wdNotAMergeDocument
objWord.Visible = True
objWord.Documents(FileToOpen).Activate
objWord.WindowState = 1
 
G

Graham Mayor

One workaround that you could try - that I have used in such circumstances
is to add the following

objWord.WindowState = wdWindowStateMinimize
objWord.Visible = True
objWord.WindowState = wdWindowStateNormal

in place of
objWord.Visible = True

which forces the document to the front.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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