This code will create a search folder in Outlook 2003+. Its convienent when you frequently run the
same search over and over again.
The search folder contents (if any hits are returned) are not actually in the folder but is just a query view result
listing. So if you were to delete the search folder you will not be deleting the contents. But if you view a particular
found item and delete it, then you will be deleting the actual item.
The SCOPE is newly added to 2003 but is originally from Exchange Server.
Enjoy and please post any comments or features you would like to see.
VB Code:
Option Explicit
'Add reference to MS Outlook 11.0 Object Library
Private Sub Command1_Click()
Dim oApp As Outlook.Application
Dim oSearch As Outlook.Search
Dim oInbox As Outlook.MAPIFolder
Dim oSearchFolder As Outlook.MAPIFolder
Dim sFolderPath As String
Dim sScope As String
Dim sFilter As String
On Error Resume Next
Set oApp = New Outlook.Application
Set oInbox = oApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)