Outlook macro that checks all selected mails in a folder and gets the delivered and read data to an excel. need help.
I have this code from David. that gets the read and delivered data to an excel. at present the tracking is not created because the mails read and delivered confirmation mails get into a folder called "Delivered&Read"
I need help with a work around for this situation.
Const xlWorkbookDefault = 51
Dim olkMessage As Outlook.MailItem, _
olkRecipient As Outlook.Recipient, _
excApp As Object, _
excBook As Object, _
excSheet As Object, _
lngRow As Long
Set excApp = CreateObject("Excel.Application")
Set excBook = excApp.Workbooks.Add()
Set excSheet = excBook.Worksheets(1)
excApp.Visible = True
.Cells(1, 1) = "Subject"
.Cells(1, 2) = "To"
.Cells(1, 3) = "Delivered"
.Cells(1, 4) = "Read"
lngRow = 2
For Each olkMessage In Application.ActiveExplorer.Selection
excSheet.Cells(lngRow, 1) = olkMessage.Subject
For Each olkRecipient In olkMessage.Recipients
excSheet.Cells(lngRow, 2) = olkRecipient.Address
Select Case .TrackingStatus
excSheet.Cells(lngRow, 3) = olkRecipient.TrackingStatusTime
excSheet.Cells(lngRow, 4) = olkRecipient.TrackingStatusTime
lngRow = lngRow + 1
Set excSheet = Nothing
'Change the file name and path on the next line'
excBook.SaveAs "C:\eeTesting\Message Tracking.xlsx", xlWorkbookDefault
Set excBook = Nothing
Set excApp = Nothing
Set olkRecipient = Nothing
Set olkMessage = Nothing
MsgBox "Done", vbInformation + vbOKOnly, "Recipient Report"