Advanced Search in MS Outlook by VBA and SQL

Status
Not open for further replies.

Bamerand

Senior Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
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
 
Dear Diana,

Thank you! That was helpful! :)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
farrissf Outlook 2016 Optimizing Email Searches in Outlook 2016: Seeking Insights on Quick Search vs Advanced Search Features Using Outlook 0
C Advanced search terms for "Outlook Data File" Using Outlook 1
mll persistently customise columns in outlook advanced search Using Outlook 3
R Outlook for Mac - Advanced Search and Tracking Sent Emails Using Outlook 0
A Outlook Advanced Search Problems...returns with an Error: Argument Outlook VBA and Custom Forms 1
T Outlook 2007 Indexing Options and Advanced Search options disabled Using Outlook 5
D Create advanced search (email) via VBA with LONG QUERY (>1024 char) Outlook VBA and Custom Forms 2
D Advanced e-Mail search on from/to contact group only searches for first 20 contacts in group Using Outlook 0
O Advanced search - can I use booleans Using Outlook 3
D Advanced Search Question Using Outlook 1
B Printing Advanced Search Output Screen Using Outlook 5
P Open Advanced Search Dialog Outlook VBA and Custom Forms 1
S Related messages show in main Outlook window vice new Advanced Find windows Using Outlook 1
M Sorting by Day in Date Column Advanced Filter BCM (Business Contact Manager) 1
L unblocking attachments before sending Office 365 Advanced Protection Using Outlook 0
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
H "Advanced find: column for full folder path? Using Outlook 1
skylark53 Advanced recurrence problem Using Outlook 2
Andrew Hawkins "Advanced Find" Using Outlook 1
A Advanced find query facilty Help please Using Outlook 2
P Outlook Advanced Find Using Outlook 0
S Advanced Find text field limits Using Outlook 2
C O2010: Using Advanced Find to locate exact queries Using Outlook 3
V Advanced Find - [Today]-3 ? Using Outlook 4
N Outlook 2010 crippled Advanced Find, now what? Using Outlook 3
H Outlook 2010 Advanced Find - Menu items missing Using Outlook 1
D Outlook 2010 - Advanced Find - No Status Bar = No Item Count Using Outlook 2
J How to filter by address fragment (e.g. "@domain.com") with advanced find? Using Outlook 2
L How to customize the Advanced Find form Outlook VBA and Custom Forms 1
D Re: How to customize the Advanced Find form Outlook VBA and Custom Forms 1
J Advanced outlook trick: help needed! Outlook VBA and Custom Forms 3
S Programmatically bring up Advanced Find for contacts? Outlook VBA and Custom Forms 1
M Search message, then (1) Jump to folder & (2) Select message that you searched for Outlook VBA and Custom Forms 2
G Search Folders and Jump to Folder Outlook VBA and Custom Forms 2
A 'search people' now asks me to 'press enter' Using Outlook 8
A Relocate Search Bar in Outlook Using Outlook 2
A Search folder and move the email Outlook VBA and Custom Forms 0
T How to find or display the sub-folder name for an Archive Search Using Outlook 10
P Search folder: all emails sent to or from a domain Using Outlook 1
T Outlook365 search item listed as "potential matches" can't be opened Using Outlook 0
Victor_50 Outlook 2019 Jump to folder from search folder Outlook VBA and Custom Forms 0
E Outlook 365 Save Selected Email Message as .msg File - oMail.Delete not working when SEARCH Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro GoTo user defined search folder Outlook VBA and Custom Forms 6
J Outlook search bar in Office 2021 Professional Using Outlook 1
T Outlook 365 Search Box reverting to old location Using Outlook 2
P Outlook 2013 search no longer works Using Outlook 2
C How to search for items in Outbox with multiple accounts? Using Outlook 20
J search doesn't find anything Using Outlook 1
kkqq1122 How would I add Search for attachment name Outlook VBA and Custom Forms 3
A Any way to force sort by/group by on search results with VBA? Outlook VBA and Custom Forms 1

Similar threads

Back
Top