A
atwork
Hello,
I am trying to send an email from a spread sheet. Below is what i have done
so far but what I want to do is select the values in A1 (A1 is the email
address) and send the email then select the value in A2 (A2 is the next email
address) and send the email and so on but i have to stop after sending 200
emails even though i have about 3000 in the excel spread sheet. The cc
address and bcc address will be the same every time.
Sub SENDMAIL()
Dim olApp As Object
Dim olNs As Object
Dim olMail As Object
Dim Email_Address
Dim ExcApp As Object
Dim Excval As String
Set ExcApp = Application.CreateObject("excel.application")
Set ExcWb = ExcApp.Workbooks.Open("C:\users\XXX\mailing\send.xls")
Excval = ExcWb.sheets("sheet1").Range("A1").Value
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = Excval
.CC = "(e-mail address removed)"
'.BCC = "(e-mail address removed)"
.Subject = "We test and test"
.Body = "another test two"
.Attachments.Add "c:\users\XXX\Mailing\test.txt"
.Send
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub
I am trying to send an email from a spread sheet. Below is what i have done
so far but what I want to do is select the values in A1 (A1 is the email
address) and send the email then select the value in A2 (A2 is the next email
address) and send the email and so on but i have to stop after sending 200
emails even though i have about 3000 in the excel spread sheet. The cc
address and bcc address will be the same every time.
Sub SENDMAIL()
Dim olApp As Object
Dim olNs As Object
Dim olMail As Object
Dim Email_Address
Dim ExcApp As Object
Dim Excval As String
Set ExcApp = Application.CreateObject("excel.application")
Set ExcWb = ExcApp.Workbooks.Open("C:\users\XXX\mailing\send.xls")
Excval = ExcWb.sheets("sheet1").Range("A1").Value
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = Excval
.CC = "(e-mail address removed)"
'.BCC = "(e-mail address removed)"
.Subject = "We test and test"
.Body = "another test two"
.Attachments.Add "c:\users\XXX\Mailing\test.txt"
.Send
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub