Hi im new to vbScript.
I have an Excel sheet, one column with emails and another with Subjects (for the emails). Im trying to send emails to the different recipients with different subjects e.g.:
A B
1 mail1@mail.com subject1
2 mail2@mail.com subject2
3 mail3@mail.com subject3
I have the following code:
Sub email()
Dim Count As Integer
Set objMessage = CreateObject("Outlook.Application").OutApp.CreateItem(0)
For Count = 1 To 3 //Assuming there are only 3 rows. But how can i make it loop till the end of the rows?
objMessage.Subject = "Mail to" & ActiveSheet.Cells(Count, 1) //e.g. Email to mail1@mail.com must have a subject "Mail to subject1"
objMessage.From = "me@my.com"
objMessage.BCC = ActiveSheet.Cells(Count, 2)//Bcc is required
objMessage.TextBody = "This is some sample message text."
objMessage.Send
Next
Set objMessage = Nothing
End Sub
I got to many error messages, the latest is:
"Object doesn't support this property or method" at "CreateObject("Outlook.Application").OutApp.CreateItem(0)" Line
Any help with this code?
I have an Excel sheet, one column with emails and another with Subjects (for the emails). Im trying to send emails to the different recipients with different subjects e.g.:
A B
1 mail1@mail.com subject1
2 mail2@mail.com subject2
3 mail3@mail.com subject3
I have the following code:
Sub email()
Dim Count As Integer
Set objMessage = CreateObject("Outlook.Application").OutApp.CreateItem(0)
For Count = 1 To 3 //Assuming there are only 3 rows. But how can i make it loop till the end of the rows?
objMessage.Subject = "Mail to" & ActiveSheet.Cells(Count, 1) //e.g. Email to mail1@mail.com must have a subject "Mail to subject1"
objMessage.From = "me@my.com"
objMessage.BCC = ActiveSheet.Cells(Count, 2)//Bcc is required
objMessage.TextBody = "This is some sample message text."
objMessage.Send
Next
Set objMessage = Nothing
End Sub
I got to many error messages, the latest is:
"Object doesn't support this property or method" at "CreateObject("Outlook.Application").OutApp.CreateItem(0)" Line
Any help with this code?