Shakti Bansal
Member
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.
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: