Hi I need help with filter all the unread emails in a search folder that is created using the VBA code below. Basically, I need to add the logic to filter out emails that are sent by internal people and forwarded messages. Please advise how do I accomplish this task. I am bit new to this so need some help. I will appreciate it. Thanks!!
Sub CreateSearchFolder_AllNotRepliedEmails()
Dim strScope As String
Dim strRepliedProperty As String
Dim strFilter As String
Dim objSearch As Outlook.Search
'Specify the folders to be searched
'Here we use Inbox folder for an example
strScope = "'" & Application.Session.GetDefaultFolder(olFolderInbox).FolderPath & "'"
'Search filter
strRepliedProperty = "http://schemas.microsoft.com/mapi/proptag/0x10810003"
strFilter = Chr(34) & strRepliedProperty & Chr(34) & " <> 102" & "AND" & Chr(34) & strRepliedProperty & Chr(34) & " <> 103"
Set objSearch = Outlook.Application.AdvancedSearch(Scope:=strScope, Filter:=strFilter, SearchSubFolders:=True, Tag:="SearchFolder")
'Save the search folder
objSearch.Save ("Not Replied Emails")
MsgBox "Search folder is created successfully!", vbInformation + vbOKOnly, "Search Folder"
End Sub
Sub CreateSearchFolder_AllNotRepliedEmails()
Dim strScope As String
Dim strRepliedProperty As String
Dim strFilter As String
Dim objSearch As Outlook.Search
'Specify the folders to be searched
'Here we use Inbox folder for an example
strScope = "'" & Application.Session.GetDefaultFolder(olFolderInbox).FolderPath & "'"
'Search filter
strRepliedProperty = "http://schemas.microsoft.com/mapi/proptag/0x10810003"
strFilter = Chr(34) & strRepliedProperty & Chr(34) & " <> 102" & "AND" & Chr(34) & strRepliedProperty & Chr(34) & " <> 103"
Set objSearch = Outlook.Application.AdvancedSearch(Scope:=strScope, Filter:=strFilter, SearchSubFolders:=True, Tag:="SearchFolder")
'Save the search folder
objSearch.Save ("Not Replied Emails")
MsgBox "Search folder is created successfully!", vbInformation + vbOKOnly, "Search Folder"
End Sub