Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Salem, Oregon, USA
    Posts
    219
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is immediately merged document the active document (Office XP SR1)

    If you merge a document, is the merged document the "active document" immediately after merge? I believe so --

    Is there any way to specify that the document is the just-merged document (besides being the active document) so you can save it to a specific name?

    I wanted to use the user's open instance of Word (getobject vs createobject) if it were open, and I worry about stumbling over other, possibly unsaved documents. I'm initiating the merge from the Access database that holds the datasource.

    Sorry for something so simple, I have spent the past hour and a half searching help files and then this Lounge, so I did give it a good college try!

    Pat

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Is immediately merged document the active document (Office XP SR1)

    Yes, the merged document becomes the active document immediately after a mail merge:

    Dim wrdMainDoc As Word.Document
    Dim wrdMergedDoc As Word.Document
    ...
    With wrdMainDoc.MailMerge
    ...
    .Execute
    End With
    Set wrdMergedDoc = wrdApp.ActiveDocument
    ...

    I have found this to be quite dependable.
    Alternatively, you could look for a document named Lettersn where n is an integer (if you merge to letters), but that is trickier - there could be other such documents open.

  3. #3
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Salem, Oregon, USA
    Posts
    219
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is immediately merged document the active document (Office XP SR1)

    Thank you so much again, Hans !! I had done some testing, and I had come to that conclusion but still worried <g>. Can't trust myself, I guess.

    You are correct about the uncertainty of the merged document temporary name. In this case, it would be "Directory1" which is even rarer, but you never know.

    Pat

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •