PDA

View Full Version : Display all e-mails with certain category in Outlook



cnapan
11-18-2021, 05:37 AM
I would like to create a macro that will display all e-mails in certain category. So far I am using:


Sub GDPR()
Dim myOlApp As New Outlook.Application
txtSearch = "category:=(""Personal Data"")"
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
Set myOlApp = Nothing
End Sub

it works but a bit strange, because it also shows an e-mails without any category, but including Personal Data in the body. I thought that the category:= syntax is special for categories only, and by using it only categorized e-mail will be returned.
Any better method to achieve that apart using search function macro?