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

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Is immediately merged document the active document (Office XP SR1)

    Author
    Topic
    #428622

    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

    Viewing 0 reply threads
    Author
    Replies
    • #996154

      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.

      • #996291

        Thank you so much again, Hans !! I had done some testing, and I had come to that conclusion but still worried . 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

    Viewing 0 reply threads
    Reply To: Is immediately merged document the active document (Office XP SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: