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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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....
 
Back
Top