Results 1 to 9 of 9
  1. #1
    Baldeagle is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Northern Ireland
    Posts
    136

    Mailmerge an Email with an attachment

    In my database which is used by a charity I have a button which opens a mailmerge email document in MS Word using the following Visual Basic code -
    FollowHyperlink "C:\Our Folders\BWMC\July Donors Email.docx", , True, True
    This mailmerge document draws its personal information from a query in my database. And sends off personal emails to a number of donors.

    I want to attach a personal document called 'Allocations.docx' which is also a mailmerge document drawing its personal information from the same query. How can I automate the attachment of this document to the email so that each donor gets their own email plus their own attachment?



    While I have made good progress with my understanding of MS Access I have little ability with Visual Basic. Can something be added to the existing line of VB which will do what I want? If so, what do I need to add?

    Any help would be appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The FollowHyperlink is just opening a Word document. There must be some more code that actually transmits the email. Is there VBA code behind the mailmerge template?

    Email is a common topic. Search the forum or google.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Baldeagle is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Northern Ireland
    Posts
    136
    When the Word document opens I use 'Finish & Merge' in the 'Mailings' tab to merge the data and send the emails. But how do I get the attachment to automatically attach to each of the emails?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I think it's going to be complicated. I googled: VBA Word mailmerge attachment

    Here is one http://word.mvps.org/FAQs/MailMerge/...ttachments.htm

    I think that code is actually saving the main mailmerge as an attachment to an email. Having a merged document email with another merge document as attachment doesn't look easy, if even possible.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Baldeagle is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Northern Ireland
    Posts
    136
    I think you're right!! Perhaps a not very professional solution might be to say in the first email that a second email will follow containing the Allocations form. The second email will simply be the Allocations.docx with the donor's personal details on it.

    Can anyone think of a more suitable alternative?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I've never done mailmerge but have done email with attachments. It is possible to send an email with multiple attachments, just not sure about mailmerge documents.

    Multiple attachments requires repeated adding to the Attachments property to build string of the multiple file paths. For only 2 attachments just do two add statements

    .Attachments.Add "path to first document"
    .Attachments.Add "path to second document"

    Does the Finish & Merge email action actually create an Outlook email with the Word document attached? Or is the Word document converted to the body of the email?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Baldeagle is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Northern Ireland
    Posts
    136
    The first Word document (July Donors Email.docx) is sent as the body of an email by MS Outlook - the individual emails all appear in my Sent box. I am wanting the second Word document (Allocations.docx) to be an attachment to those emails (obviously linked to the same donor's personal details).

    Maybe I ought to change my focus to the Word forum as I suppose the solution to my problem may come from an expert in Word rather than Access?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    If the Finish & Merge doesn't offer an attachment option, in particular another merge document, then I suspect the only recourse is VBA email with multiple attachments. A Word document is attachable, it's just the merge document I am not sure of. Might have to save both as PDF and send those as attachments.

    Yes, you might have more luck in a Word forum.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Baldeagle is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Northern Ireland
    Posts
    136
    Thanks for interacting with me on this. The 'Finish and Merge' allows you to specify if you want the document to go as an attachment or as an email - but there is no option to add an attachment at that stage.

    I think I will try the Word forum in the morning.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Sending Report from Access as attachment in Email
    By taimysho0 in forum Programming
    Replies: 16
    Last Post: 02-09-2012, 12:07 PM
  2. Extract file attachment from email to Access
    By bet in forum Import/Export Data
    Replies: 3
    Last Post: 02-02-2011, 07:35 PM
  3. Send in Email Body vice Attachment
    By cassidym in forum Programming
    Replies: 2
    Last Post: 10-20-2010, 06:21 AM
  4. Beginner trying to send email with attachment
    By ahm in forum Programming
    Replies: 2
    Last Post: 03-24-2009, 08:51 PM
  5. email attachment from Access
    By Gandalf in forum Queries
    Replies: 0
    Last Post: 01-22-2009, 10:03 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums