hk129
07-14-2015, 08:48 AM
Hi everyone,
I am trying to create a program in excel to send out emails (the emails contain data from the cells). Here is a sample of my code (not completed):
Sub Send_Mail(ActiveCell)
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ActiveCell.Offset(0, -2).Text
On Error GoTo 0
.CC = ""
.BCC = ""
.Subject = "AUTOMATED MESSAGE" + ActiveCell.Offset(0, -4).Text
.Body = "This is a test: " + ActiveCell.Offset(0, -4).Text
.Send
ActiveCell.Offset(0, 1).Value = "YES"
On Error GoTo 0
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I can successfully send out my emails but I have no way of keeping track of the emails that got send. When I open outlook, there is nothing in my sent folder.
Can anyone help me out?
Thank you in advance.
I am trying to create a program in excel to send out emails (the emails contain data from the cells). Here is a sample of my code (not completed):
Sub Send_Mail(ActiveCell)
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ActiveCell.Offset(0, -2).Text
On Error GoTo 0
.CC = ""
.BCC = ""
.Subject = "AUTOMATED MESSAGE" + ActiveCell.Offset(0, -4).Text
.Body = "This is a test: " + ActiveCell.Offset(0, -4).Text
.Send
ActiveCell.Offset(0, 1).Value = "YES"
On Error GoTo 0
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I can successfully send out my emails but I have no way of keeping track of the emails that got send. When I open outlook, there is nothing in my sent folder.
Can anyone help me out?
Thank you in advance.