+ Reply to Thread
Results 1 to 2 of 2

Send multiple emails with one attachment each

  1. #1
    Registered User
    Join Date
    07-21-2016
    Location
    n/a
    MS-Off Ver
    2013
    Posts
    2

    Send multiple emails with one attachment each

    Hi! I really need your help as I am a newbie and can't get the right code.
    What I would like to achieve is to send all the files in a folder as attachment to a single recipient. BUT, it must be one email per attachment. So if I have 20 files in a folder, I would also have 20 emails. It varies depending on how many files the folder has.
    The subject of each email must be the same with the file name which are entered in Column B.

    Please assist me in coding this in VBA Macro.

    Thank you!

  2. #2
    Registered User
    Join Date
    07-21-2016
    Location
    n/a
    MS-Off Ver
    2013
    Posts
    2

    Re: Send multiple emails with one attachment each

    So I was able to figure out the right code. what I did was:
    Column C - File Names (which should be the same with the subject)
    Column D - File Path
    Recipient's address is just one.

    So here's the code:
    Sub Send_Email()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim lr As Long
    Dim r As Long
    lr = Cells(Rows.Count, "B").End(xlUp).Row
    For r = 1 To lr

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
    .To = "[email protected]"
    .Subject = Range("C" & r).Value
    .Body = "Please find attached invoice for processing."
    .Attachments.Add Range("D" & r).Value
    .Send
    End With
    On Error GoTo 0
    Next r

    MsgBox "E-mail successfully sent", 64
    Application.DisplayAlerts = False

    Set OutMail = Nothing
    Set OutApp = Nothing

    End Sub

    Hope this helps!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using Excel to send Multiple emails and logging
    By Ambience247 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2016, 04:38 PM
  2. Macro to send different emails to different people with attachment
    By Dr.Tenma in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-07-2015, 08:15 AM
  3. [SOLVED] Macro To Send Emails with PDF: Multiple Emails and PDF's
    By totoga12 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-19-2014, 06:13 PM
  4. VBA to send multiple emails does not complete
    By gillyr7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2014, 10:01 AM
  5. VBA to send multiple emails with different attachments
    By gillyr7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2014, 02:33 PM
  6. Macro to send email with multiple attachment
    By excelcheck123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2012, 05:00 PM
  7. Send emails to multiple addresses
    By jenksie101 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-02-2010, 09:53 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1