ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   E-mail macro - how do I attach multiple attachments? (https://www.excelbanter.com/excel-discussion-misc-queries/113406-e-mail-macro-how-do-i-attach-multiple-attachments.html)

G and (ajk)

E-mail macro - how do I attach multiple attachments?
 
Hi,

I am using the macro below to send e-mails out to customers.

Sub Mail_workbook_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strto As String

For Each cell In ThisWorkbook.Sheets("Sheet1") _
.Columns("a").Cells.SpecialCells(xlCellTypeConstan ts)
If cell.Value Like "*@*" Then
strto = strto & cell.Value & ";"
End If
Next
strto = Left(strto, Len(strto) - 1)

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ""
.CC = ""
.BCC = strto
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ("")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

(I know that there isn't a command in there to quit outlook). Anyway, I
know how to attach one document, but is there a way using this macro that I
can send a message with multiple attachments? If so, can someone please tell
me how?

THANKS!

Ron de Bruin

E-mail macro - how do I attach multiple attachments?
 
Repeat this line

..Attachments.Add


--
Regards Ron de Bruin
http://www.rondebruin.nl



"G and (ajk)" wrote in message ...
Hi,

I am using the macro below to send e-mails out to customers.

Sub Mail_workbook_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strto As String

For Each cell In ThisWorkbook.Sheets("Sheet1") _
.Columns("a").Cells.SpecialCells(xlCellTypeConstan ts)
If cell.Value Like "*@*" Then
strto = strto & cell.Value & ";"
End If
Next
strto = Left(strto, Len(strto) - 1)

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ""
.CC = ""
.BCC = strto
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ("")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

(I know that there isn't a command in there to quit outlook). Anyway, I
know how to attach one document, but is there a way using this macro that I
can send a message with multiple attachments? If so, can someone please tell
me how?

THANKS!





All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com