hi,
I have a list of email address in exce in the range A1:A10
I want to send an email one by one to them, i have the the following code as i don't want the annoying popup each time it sends an email but it doesn't seem to wrk even if i use outlook library references it doesnt work any help would be great
code:
Option Explicit
Dim objOut As Object
Sub SendBulkMail()
Dim addresses As Range
Set addresses = Range(Range("A1"), Range("A1").End(xlDown))
Dim rAddr As Range
Application.DisplayAlerts = False
Set objOut = CreateObject("Outlook.Application")
For Each rAddr In addresses.Rows
Call SendMail(rAddr)
Next rAddr
Set objOut = Nothing
Application.DisplayAlerts = True
End Sub
Sub SendMail(r As Range)
Dim objMail As Object
Dim OutApp As Object
Dim strEmail As String
Dim strSubject As String
Dim strBody As String
On Error Resume Next
Set objMail = OutApp.CreateItem(0)
strEmail = r.Cells(1, 2)
strSubject = "subject line"
strBody = "Boby of email"
With objMail
.To = strEmail
.HtmlBody = strBody
.Subject = strSubject
.Attachments.Add ("C:\attachment1.doc")
.Attachments.Add ("c:\attachment2.doc")
.Send
End With
End Sub
Thanks in advance
Bookmarks