I have a VBA code in Outlook 365 that reads emails in a secondary mailbox[Common mailbox for email triggers from ERP] I’m reading emails that have a specific Subject line and collate the email body data[this is in XML] in an excel file.
Once the email is read, mark the email as “read” & mark email’s follow-up status as Complete[The tick mark].
I’ve been looking it on Google but unable to find any solution that works. Any help would be highly appreciated. Below are the various options that I’ve tried.
`For Each olItem In olFilteredItems
If TypeOf olItem Is Outlook.MailItem Then
Set olMail = olItem
If olMail.UnRead Then
totalEmails = totalEmails + 1
' Mark email as read
olMail.UnRead = False
olMail.Categories = "Completed" ' Assign the category
olMail.Save ' This fails explixitly
olMail.FlagStatus = olFlagComplete
olMail.IsMarkedAsTask
olMail.MarkAsTaskComplete
olMail.MarkAsTask
End If
End If
Next olItem`
user2101680 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.