Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    Lounger
    Join Date
    May 2015
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    From Directory mailmerge to Email

    Dear all

    I have a attached zip folder which has Excel Data sheet, MyMailmerge word doc and Outcome Word.

    I managed to do a Directory mail merge on to the Word document using MyMailmerge document (it has a macro) this is in the attached Outcome document. I like the way it looks on the Outcome document. It is very neat and it adds up the value too.

    My problem is I can't email per page which is in the Outcome document individually to the relating email addresses on the Excel Data sheet.

    Is there a way I can email each page to the relating email addresses as they look on the Outcome document? Your help would be appreciated.


    Kind regards
    Attached Files Attached Files
    Last edited by lapot; 2015-06-23 at 04:33.

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    To send the output for each formatted page as the email body, you'll need to use Outlook as your default email program and send the emails in HTML format.

    If you want to send the pages as attachments to your emails, you'll need to split them into separate documents first. If you modify your code to insert Section breaks instead of page breaks, you can use the 'Split Merged Output to Separate Documents' macro in my Mailmerge Tips and Tricks thread:
    http://windowssecrets.com/forums/sho...ips-amp-Tricks
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    Lounger
    Join Date
    May 2015
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by macropod View Post
    To send the output for each formatted page as the email body, you'll need to use Outlook as your default email program and send the emails in HTML format.
    [/url]
    Hi Macropod,

    Thank you for replying, you are the best person on this subject so far I came across the whole net. Thank you in advance once more.

    I like to send the out put for each formatted page as the email body. My outlook is my default email program but it wont let me send it. I get a message saying " You cannot send a catalog created by merging documents directly to mail , fax, or printer"

    Can you advice please?

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by lapot View Post
    I like to send the out put for each formatted page as the email body. My outlook is my default email program but it wont let me send it. I get a message saying " You cannot send a catalog created by merging documents directly to mail , fax, or printer"

    Can you advice please?
    That message is correct. You will need to send the merge output to file, then use the pages from that for your emails. That's why I gave you the link to the 'Split Merged Output to Separate Documents' macro and advised you to use Section breaks rather than page breaks.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    Lounger
    Join Date
    May 2015
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks again

    sorry to be a thickhead

    do I add Split Merged Output to Separate Documents macro to the Outcome document or MyMaimerge document?

  6. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    It doesn't matter which document you add it to, provided the outcome document is the active one when the macro is run. It makes more sense, though, to add the macro to your mailmerge main document, from where your existing code can call it once the output document has been saved.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  7. #7
    Lounger
    Join Date
    May 2015
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I cant work out what fields I need to put in the code where I highlighted in bold. Sorry.

    Code:
    Sub Merge_To_Individual_Files()
    'Merges one record at a time to the folder containing the mailmerge main document.
    ' Sourced from: http://windowssecrets.com/forums/showthread.php/163017-Word-Mailmerge-Tips-amp-Tricks
    Application.ScreenUpdating = False
    Dim StrFolder As String, StrName As String, MainDoc As Document, i As Long, j as long
    Set MainDoc = ActiveDocument
    With MainDoc
      StrFolder = .Path & Application.PathSeparator
      For i = 1 To .MailMerge.DataSource.RecordCount
        With .MailMerge
          .Destination = wdSendToNewDocument
          .SuppressBlankLines = True
          With .DataSource
            .FirstRecord = i
            .LastRecord = i
            .ActiveRecord = i
            If Trim(.DataFields("Last_Name")) = "" Then Exit For
            StrName = .DataFields("Last_Name") & "_" & .DataFields("First_Name")
          End With
          .Execute Pause:=False
        End With
        For j = 1 To 255
          Select Case j
            Case 1 To 31, 33, 34, 37, 42, 44, 46, 47, 58 - 63, 91 - 93, 96, 124, 147, 148
            StrName = Replace(StrName, Chr(j), "")
          End Select
        Next
        StrName = Trim(StrName)
        With ActiveDocument
          .SaveAs FileName:=StrPath & StrName & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False
          ' and/or:
          .SaveAs FileName:=StrPath & StrName & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
          .Close SaveChanges:=False
        End With
      Next i
    End With
    Application.ScreenUpdating = True
    End Sub
    [

  8. #8
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    That isn't the code I referred you to...
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  9. #9
    Lounger
    Join Date
    May 2015
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh sorry. I used the correct one this time and it asks me how many breaks I need per page I chose 1 then nothing happens

  10. #10
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Did you change your mailmerge main document's code that inserts page breaks between groups to insert Section breaks instead?
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  11. #11
    Lounger
    Join Date
    May 2015
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh didn't. I am very sorry , I am new on mail merge I find it hard. I will try. Thanks for your help , you are a star as always

  12. #12
    Lounger
    Join Date
    May 2015
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I couldn't work it out would you mind helping me out to do it, I m really sorry.

  13. #13
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    In your mailmerge main document's field code, where you see the field coded as '{QUOTE 12}', replace that with a pair of double quotes and insert a Section break between them.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  14. #14
    Lounger
    Join Date
    May 2015
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by macropod View Post
    In your mailmerge main document's field code, where you see the field coded as '{QUOTE 12}', replace that with a pair of double quotes and insert a Section break between them.
    Do I change this

    Code:
    “}{IF{MERGEFIELD Name}<>0”{IF{MERGESEQ}>1{QUOTE 12}}{SET Key {MERGEFIELD Name}}{DATE\@ “DD-MMM-YYYY”}
    To this
    Code:
    “}{IF{MERGEFIELD Name}<>0”{IF{MERGESEQ}>1 "  ........Page Break........  "}{SET Key {MERGEFIELD Name}}{DATE\@ “DD-MMM-YYYY”}
    ???

    thanks
    Last edited by macropod; 2015-06-24 at 04:52. Reason: Fixed CODE tagging

  15. #15
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    No. Read post #13 again.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Page 1 of 3 123 LastLast

Posting Permissions

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