I want to find mail in the olFolderSentMail folder, using the domains of the email addresses, with VBA.
When I make an advanced filter in Outlook, the result comes. I got the sql code from there. There is no result in VBA.
For example, I want to find a@kpmg.com, b@kpmg.com both together. Only names appear in the whom section in Outlook as a and b. Mail addresses are hidden in names.
Sub sentmails()
Dim objNS As Outlook.Namespace: Set objNS = GetNamespace("MAPI") Dim
olFolder As Outlook.MAPIFolder
Set olFolder = objNS.GetDefaultFolder(olFolderSentMail)
filterstr = "@SQL=(""http://schemas.microsoft.com/mapi/proptag/0x0e04001f""
CI_STARTSWITH 'kpmg' OR ""http://schemas.microsoft.com/mapi/proptag/0x0e03001f"" CI_STARTSWITH 'kpmg')"
Set arama = olFolder.Items.Restrict(filterstr)
End Sub