• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Advanced Search in MS Outlook by VBA and SQL

Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
#1
Here is a code I was able to modify to meet my expection (got from www.slipstick.com). It loops thru entire Outlook and find (in different PST) emails received / sent within today. So far so good. Now, it also searches for and finds Outlook items such new contacts in "Recipient Cache", "Tasks", "Calendar" and "Sync Issues". Is there a way to add a line that will allow to skip the above mentioned "Recipient Cache", "Tasks", "Calendar" and "Sync Issues"? Filtering does not do good as the filter enableed search process slowes down the PC by almost 10 times, for with no filter applied the search takes no more that 15 seconds in total, meanwhile enabling filter in views makes the search more than 2.5-3 minutes. I am open to any suggestions.

Sub SentToday()
Dim myolApp As New Outlook.Application
Dim tDate As Date
On Error GoTo ErrHandler
tDate = Date 'Today
txtSearch = "sent: (=" & tDate & ")"
myolApp.ActiveExplorer.Search txtSearch, olSearchScopeAllOutlookItems
Set myolApp = Nothing
Exit Sub
ErrHandler:
MsgBox "Oops, an error has occured." & vbCrLf & vbCrLf & "Error Code : " & Err.Number & " , " & Err.Description
Call GoToMyInbox
End Sub
 

Similar threads