How do I activate the new document after I run a mail merge?

B

Bill

After I run the following lines of code, I want to activate the new document
that was created.

objWordDoc.MailMerge.Destination = 0 '0 = wdSendToNewDocument
objWordDoc.MailMerge.Execute

I can't use AppActivate since I don't know the title of the new document. I
am using late binding because I am not sure what version of Word the user has
on their machine. This means that I can't use the shell command to get the
app ID.

My need is particularly critical in Vista where the newly created document
is not automatically the active application as was the case with XP.
 
A

Albert D. Kallal

Bill said:
After I run the following lines of code, I want to activate the new
document
that was created.

objWordDoc.MailMerge.Destination = 0 '0 = wdSendToNewDocument
objWordDoc.MailMerge.Execute

I can't use AppActivate since I don't know the title of the new document.
I
am using late binding because I am not sure what version of Word the user
has
on their machine. This means that I can't use the shell command to get the
app ID.

My need is particularly critical in Vista where the newly created document
is not automatically the active application as was the case with XP.


TRY:
wordApp.Activate
wordApp.WindowState = 0 'wdWindowStateRestore

objWordDoc.Visible = True
objWordDocM.Activate

You can try this without the wordApp.Activate, but I think you need both....
 

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