Hi im new to vba.
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:
[VBA]Set OutApp = CreateObject("Outlook.Application")
For Count = 1 To 3 //Assuming there are only 3 rows. But how can i make it loop till the end of the rows?
Set objMessage = OutApp.CreateItem(0)
objMessage.Subject = "Mail to" & ActiveSheet.Cells(Count, 1)//e.g. Email to mail1@mail.com must have a subject "Mail to subject1"
objMessage.Bcc = ActiveSheet.Cells(Count, 2) //Bcc is required
objMessage.Body = "This is some sample message text."
objMessage.Send
Next[/VBA]
But i'm getting an "Outlook does not recognize one or more names" error.
Any help with this code?