Results 1 to 12 of 12
  1. #1
    Star Lounger
    Join Date
    Mar 2007
    Location
    Dexter, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mail Merg (2000)

    I have prepared a lot of quotes for our dealers and originally, I was to mail them all out myself. I have created a mail merg file which worked well but now the majority of them are to be hand delivered or emailed over by the sales rep assigned to their territory. Is there an easy way to break that mail merg document apart so it creates individual documents instead of one big word doc? The word document has an Access query as the data source.

    I am frustrated beyond all measure.

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

    Re: Mail Merg (2000)

    You can use a macro to split the big merged document into separate documents: see Doug Robbin's reply here.

  3. #3
    Star Lounger
    Join Date
    Mar 2007
    Location
    Dexter, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merg (2000)

    Thank you Hans. I want to save them as seperate files but I'm not sure how or where to put the macro that he provided. I've never put a macro in word, if that's where it goes. Is that something that you can help me with?

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

    Re: Mail Merg (2000)

    Try the following:
    - Make sure that the merged document is the active document in Word.
    - Use your mouse to select the text starting at Sub Splitter() up to and including End Sub at the end of this post.
    - Press Ctrl+C to copy it to the clipboard.
    - Select Tools | Macro | Visual Basic Editor or press Alt+F11 to open the Visual Basic Editor.
    - In the Visual Basic Editor, select Insert | Module to create a blank new module.
    - Press Ctrl+V to paste the text of the macro into the new module.
    - Click anywhere in the macro.
    - Select Run | Run Sub/UserForm or press F5 to execute the macro.
    - Wait until the macro has finished.

    Here is the macro text to copy:

    Sub Splitter()
    ' Macro created by Doug Robbins
    Dim Letters As Integer
    Dim Counter As Integer
    Dim DocName As String
    Letters = ActiveDocument.Sections.Count
    Selection.HomeKey Unit:=wdStory
    Counter = 1
    Do While Counter < Letters
    DocName = "MyLetter" & Counter
    ActiveDocument.Sections.First.Range.Cut
    Documents.Add
    Selection.Paste
    ActiveDocument.Sections(2).PageSetup.SectionStart = wdSectionContinuous
    ActiveDocument.SaveAs FileName:=DocName
    ActiveWindow.Close
    Counter = Counter + 1
    Loop
    End Sub

    Note: the documents will be named MyLetter1, MyLetter2 etc. You can change this by changing the text between the quotes in the line

    DocName = "MyLetter" & Counter

  5. #5
    Star Lounger
    Join Date
    Mar 2007
    Location
    Dexter, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merg (2000)

    I'm getting an error on this line: Do While Counter < Letters

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

    Re: Mail Merg (2000)

    What does the error message say?

  7. #7
    Star Lounger
    Join Date
    Mar 2007
    Location
    Dexter, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merg (2000)

    Compile Error
    Syntax error

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

    Re: Mail Merg (2000)

    The code compiles without problems on my PC.
    I have attached a screenshot of the macro. Compare it to your version, especially the line that causes the error. Do you see any difference?

  9. #9
    Star Lounger
    Join Date
    Mar 2007
    Location
    Dexter, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merg (2000)

    Do While Counter < Letters
    Do While Counter < Letters

    It works great now!
    Thank you so much!

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

    Re: Mail Merg (2000)

    It looks the same on my PC, but I suspect that the "smaller than" character had become &lt for you; VBA doesn't recognize the latter.

    Glad it's solved!

  11. #11
    Star Lounger
    Join Date
    Mar 2007
    Location
    Dexter, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merg (2000)

    I should have asked for advise long ago. This has been a very frustrating project and you and your team have simplified it so much! I really can't thank you enough!!!

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

    Re: Mail Merg (2000)

    Thank you! Glad to have been able to help.

Posting Permissions

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