none
Questions about additional attachments to a MailMerge generated Email RRS feed

  • Question

  • Another newbie question (sorry..)  Is this even possible?

    I have successfully generated an email with an attached merged Word doc using this code.


     Dim wrdApp As Word.Application = Nothing
     Dim wrdDoc As Word._Document = Nothing
     Dim wrdMailMerge As Word.MailMerge = Nothing
            
     wrdApp = CreateObject("Word.Application")          
     wrdDoc = wrdApp.Documents.Open(wordFile, False, True)            
     wrdMailMerge = wrdDoc.MailMerge()
     With wrdMailMerge
            .Destination = Word.WdMailMergeDestination.wdSendToEmail
            .MailSubject = "This is a test"
            .MailAddressFieldName = "Email"
            .MailAsAttachment = True
            .Execute(Pause:=False)
      End With

    My current somewhat ill-defined goal is to programmatically gererate and email a merged word doc plus an indeterminant number of other attached files.

    2 questions:

    1.  Is it possible to use this technique to send mulitple merged word docs in one Email?

    2.  Is it possible using this basic technique to attach additional non-merged/non-Word files to the email before executing?  (i.e. image files, PDFs, whatever.)

    (So far I just don't see anything in the properties that would allow me to do that.)


    Thursday, June 23, 2011 7:32 PM

All replies

  • 1. Not multiple documents, but if you can group the records in some way, you can send combined documents. See macropod's tutorial Catalog Mailmerge.zip in the Third Party Downloads section of http://www.gmayor.com/downloads.htm.

    2. No, you'd have to automate Outlook to do that.


    Regards, Hans Vogelaar
    Thursday, June 23, 2011 8:51 PM
  • please check this link

    http://support.microsoft.com/kb/826838

    Regards

    Mona

    Thursday, June 23, 2011 8:56 PM
  • Great article.  Thanks.  Opened up new possibilities for me.

     

    In the meantime, I have another question.   As I've said, I've successfully emailed a mail merge doc.

     

    The original doc sitting in my folder has a modification date of several days ago and it seems to be working fine on multiple tests.

     

    The only odd thing is that when I open it up manually in Word it no longer gives me that merge prompt.  All the fields are visible and in place.

    Just wondering what's happening.

    Friday, June 24, 2011 1:26 PM