Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Send Mail With Multiple Different Attachments From MS Outlook using Excel.

In ear­lier post you have learned how to send Excel Work­book as attach­ment with email from MS Out­look using Excel. In this arti­cle we will learn about how to Send Mail With Mul­ti­ple Dif­fer­ent Attach­ments From MS Out­look using Excel. These attach­ments might be any­thing, an image, word doc­u­ment, excel doc­u­ment, pdf file, text file etc.

Note: Don’t pro­vide any fil­ter in GetOpen­File­Name() to select any file as attachment.

str­File­ToOpen = Application.GetOpenFilename(Title:=“Please choose a file to open”)

I would rec­om­mend that you must read Send a Sim­ple Mail From MS Out­look Using Excel and how to send Excel Work­book as attach­ment with email from MS Out­look using Excel to under­stand the com­plete code below.

Com­plete Code:

Dim mainWB As Workbook
Sub sumit()
    Dim SendID
    Dim CCID
    Dim Subject
    Dim Body
    Dim AttachFile
    Set otlApp = CreateObject("Outlook.Application")
    Set olMail = otlApp.CreateItem(olMailItem)
    Set Doc = olMail.GetInspector.WordEditor
    Set mainWB = ActiveWorkbook

    SendID = mainWB.Sheets("Mail").Range("B1").Value
    CCID = mainWB.Sheets("Mail").Range("B2").Value
    Subject = mainWB.Sheets("Mail").Range("B3").Value
    Body = mainWB.Sheets("Mail").Range("B5").Value
    AttachFile = mainWB.Sheets("Mail").Range("B4").Value
    With olMail
        .to = SendID
        If CCID <> "" Then
          .CC = CCID
        End If
        .Subject = Subject
        mainWB.Sheets("Mail").Range("B9").Copy
        Set WrdRng = Doc.Range
        .Display
        WrdRng.Paste
        For i = 4 To 8
          atch = mainWB.Sheets("Mail").Range("B" & i).Value
          If atch <> "" Then
            .Attachments.Add atch
          End If
        Next
        .Send

    End With
    MsgBox ("you Mail has been sent to " & SendID)
End Sub
Function browse(rng)
    Dim FSO As Object
    Dim blnOpen
    Dim mainWB As Workbook
    Set mainWB = ActiveWorkbook
    strFileToOpen = Application.GetOpenFilename(Title:="Please choose a file to open")
    If strFileToOpen = False Then
      MsgBox "No file selected.", vbExclamation, "Sorry!"
      Exit Function
    Else
        mainWB.Sheets("Mail").Range(rng).Value = strFileToOpen
    End If
End Function
Sub browse1()
    browse ("B4")
End Sub
Sub browse2()
    browse ("B5")
End Sub
Sub browse3()
    browse ("B6")
End Sub
Sub browse4()
    browse ("B7")
End Sub
Sub browse5()
    browse ("B8")
End Sub

Send Mail With Multiple Different Attachments From MS Outlook using Excel

Send Mail With Mul­ti­ple Dif­fer­ent Attach­ments From MS Out­look using Excel

Send Mail With Multiple Different Attachments From MS Outlook using Excel-1

Send Mail With Mul­ti­ple Dif­fer­ent Attach­ments From MS Out­look using Excel-1

You may also like...

2 Responses

  1. Drake says:

    You are a rock­star — this helped me fix an attach­ment issue I was hav­ing for which I did almost 4 hours of research to try and fix!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: