Link to home
Start Free TrialLog in
Avatar of excelismagic
excelismagic

asked on

VBA or free to tool to do mail merge in Outlook from Excel with Attachments path in excel

I have a table, i can do mail merge, but i need to learn how to include the attachments for each name in excel into the outlook.
i have the attachments paths in one of my columns.

is there any VBA or free add-in to do this?
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Arana (G.P.)
Arana (G.P.)

requirement:
you must set your attachment filename as part of your subject , add an @ and then your real subject
example subject : c:\temp\msKB.txt@testmerge

add this to your outlook vba code:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
With Item

'here you set some keyword that you should always include in the subjects of mail merged messages so that you dont process this code for every single mail and only do it for merged ones
kw="-=mm=-" (you can remove it later if you want before sending it using the .item.subject property)

    If InStr(.Subject, "-=mm=-") > 0 Then  
        atch = Left(.Subject, InStr(.Subject, "@") - 1)
        sbj = Right(.Subject, Len(.Subject) - InStr(.Subject, "@"))
        .Attachments.Add (atch)
        .Subject = sbj
    End If
End With
End Sub

try it