• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Help required_macro to send multiple attachment

Hi,

I have below code to send emails with attachment. I need the attachment part to be amended,so that it can attach two attachments with same name. One of them is excel and second one is pdf.

Code:
Sub SendMail()

    Dim objOutlook As Object
    Dim objMail As Object
    Dim ws As Worksheet
   
    Set objOutlook = CreateObject("Outlook.Application")
    Set ws = ActiveSheet
   
  For Each cell In ws.Range("A1:A10")
 
    Set objMail = objOutlook.CreateItem(0)
   
        With objMail
            .To = cell.Value
            .cc = cell.Offset(0, 1).Value
            .Subject = cell.Offset(0, 2).Value
            .Body = cell.Offset(0, 3).Value
            .Attachments.Add cell.Offset(0, 4).Value
            .Send
        End With
       
        Set objMail = Nothing
    Next cell
   
    Set ws = Nothing
    Set objOutlook = Nothing

End Sub
>> use code - tags <<
 
Last edited by a moderator:
What is a sample value for
Code:
cell.Offset(0, 4).Value
If it does not include drive:\path, that will needed to be added too.
 
Hi,
just repeat the line:

Code:
.Attachments.Add cell.Offset(0, 4).Value
.Attachments.Add cell.Offset(0, 5).Value

As stated by Kenneth, the cell must contain the complete path and the name of the file, e.g.
C:\Users\Keetoowah\Desktop\Forum\File.xlsx
 
Back
Top