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
 

Bamerand

Senior Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Dear Diana,

Thank you! That was helpful! :)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
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
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
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 7
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
B Search and Find Email by Folder Name Outlook VBA and Custom Forms 2
C Search not accurate, but not indexing Using Outlook 9
J How do you disable address search box when typing @ in body of email? Using Outlook 0
H Outlook 2019 intermittent search results Using Outlook 0
S vba outlook search string with special characters Outlook VBA and Custom Forms 1
S VBA search string with special characters Outlook VBA and Custom Forms 1
H Search Email Header for Content Type Outlook VBA and Custom Forms 1
P Posts in Folder No Longer Group by Conversation Column After Search Using Outlook 0
Y Filter unread emails in a search folder vba help Outlook VBA and Custom Forms 0
M Reverting The Outlook Search Box Location (or other undesired additions) Using Outlook 1
M Something went wrong and your search couldn't be completed Using Outlook 1

Similar threads

Top