Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mail Merge (Word 2003)

    <img src=/S/help.gif border=0 alt=help width=23 height=15> <img src=/S/please.gif border=0 alt=please width=31 height=23> I have a process where I parse a text file and place it into an Access database. Items are selected and tagged for a mail merge. Through Access I open the MS/Word template. The document opens and displays the first merged document. Clicking the 'Merge to New Document' works great. The problem.
    There are macros written in the template to clean up the items. I have placed a button on the template to execute the macros. the button however does not remain nor is there a custom toolbar available to click to bring it back. I have to add the customized tool bar each time it is open. Also when I execute the macro under the Template (before clicking the 'Merge to New Document' button) there is only the one document for it to work on. Scrolling through to find the documents one at a time and clicking the button cleans up the data, but there could be over 9000 of these. When I click the button to merge all the documents the macros are unavailable.

    How do I get the macros and button to remain to the final merge stage.
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  2. #2
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merge (Word 2003)

    Thanks for getting back so quick Hans,

    I'm not sure I follow the 'Document Template Box' and where I'm to place in the 'Templates|Add-Ins'. Attached is what I see when I click here:
    Attached Images Attached Images
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merge (Word 2003)

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15> Hans,

    Replacing the 'normal' with the path to the template works great. The code that you posted, is that to be deployed in the template to make the new document attached to the template. I'm not seeing where that should go.

    (Hans is there 3 of you? do you ever sleep? and is your mind a sponge that just absorbs all this knowledge?) <img src=/S/salute.gif border=0 alt=salute width=15 height=20>
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

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

    Re: Mail Merge (Word 2003)

    The first text box in the dialog is labeled "Document template". If this is what you get when the merged document is active, it has lost its connection to the original template completely - the box lists Normal as document template. So you would have to select the correct template anew by entering its path and file name or by clicking Attach...

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

    Re: Mail Merge (Word 2003)

    Grrr... although this problem was supposed to have been fixed in Word 2000 (!) SR-1, it still exists. It seems that the merged document loses its connection to the template. A workaround is to select Tools | Templates and Add-Ins..., cut the text from the Document Template box (Ctrl+X), click OK, select Tools | Templates and Add-Ins... again, paste the text back in (Ctrl+V) and click OK. In VBA code this corresponds to

    Dim strTmp As String
    With ActiveDocument
    strTmp = .AttachedTemplate
    .AttachedTemplate = ""
    .AttachedTemplate = strTmp
    End With

    (replace ActiveDocument by the Document object in your code.)

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

    Re: Mail Merge (Word 2003)

    The code as I posted it worked for me in Word 2002, but it won't work in your situation. You would have to use this variation:

    With ActiveDocument
    .AttachedTemplate = ""
    .AttachedTemplate = "C:TemplatesMyTemplate.dot"
    End With

    with the appropriate path and file name substituted. If you execute the mail merge in code, you could incorporate the above lines in your code. Otherwise, you'd have to put the code in a macro in Normal.dot or in a global template, so that it is always available.

  7. #7
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merge (Word 2003)

    Thanks Hans,

    If we ever meet, All the rounds are on me. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  8. #8
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Mail Merge (Word 2003)

    As an alternative, you could use automation to actually build the merge. We encountered the same problem, and finally resorted to building the document using automation. It preserves the macros and toolbars, and actually runs a fair bit faster, especially if you are using DDE (with 2003 you probably aren't).
    Wendell

  9. #9
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merge (Word 2003)

    Thanks Wendell

    We ended up adding a global template that is available through the normal template.

    Peace once again reigns across the LAN. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

Posting Permissions

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