pkearney10
08-31-2018, 03:11 AM
Hello,
I have a macro to automatically send emails from a spreadsheet, and then log the date sent. How can I also log the Message ID / Conversation ID from the send message?
VBA Below:
Thanks!
Sub Mailing_Request_Macro()
Dim f As Range, source As Worksheet, master As Worksheet, s As String, StrBody As String
Dim olApp As Outlook.Application, olMail As Outlook.MailItem
Set source = Worksheets("Request List")
Set master = Worksheets("Master List")
Set olApp = New Outlook.Application
Set f = master.Range("A:A").Find(c.Value)
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.Display
.To = f.Offset(, 3).Value
.CC = f.Offset(, 4).Value
.Subject = "Reminder Email"
StrBody = "Hello, this is a Reminder" & vbCrLf & vbCrLf
.HTMLBody = StrBody & .HTMLBody
'.Send
End With
.Offset(, 3).Value = Date 'Source sheet, Date sent.
End With
On Error Resume Next
Set olMail = Nothing
Set olApp = Nothing
End Sub
I have a macro to automatically send emails from a spreadsheet, and then log the date sent. How can I also log the Message ID / Conversation ID from the send message?
VBA Below:
Thanks!
Sub Mailing_Request_Macro()
Dim f As Range, source As Worksheet, master As Worksheet, s As String, StrBody As String
Dim olApp As Outlook.Application, olMail As Outlook.MailItem
Set source = Worksheets("Request List")
Set master = Worksheets("Master List")
Set olApp = New Outlook.Application
Set f = master.Range("A:A").Find(c.Value)
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.Display
.To = f.Offset(, 3).Value
.CC = f.Offset(, 4).Value
.Subject = "Reminder Email"
StrBody = "Hello, this is a Reminder" & vbCrLf & vbCrLf
.HTMLBody = StrBody & .HTMLBody
'.Send
End With
.Offset(, 3).Value = Date 'Source sheet, Date sent.
End With
On Error Resume Next
Set olMail = Nothing
Set olApp = Nothing
End Sub