![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello Everyone,
I wrote a Macro that takes the selected Email, removes some text from the subject (e.g. “, FW:” etc.) and performs a search on all Emails containing this string. The results of the search are displayed in a new window. Sometimes it works as expected, and sometimes I get an error: This is how the error object holds these values: Description: "The operation failed." HelpContext: 1000440 Number: -2147219964 From when it fails, Instant search stops responding in the main window as well. All this until I restart Outlook (2007). Interestingly, when I change the Macro to display the results in the current (main) window, it always work without any problem. The code: ****************************** Sub SearchByStrippedSubject() Dim app As New Outlook.Application Dim item As Object Dim email As MailItem Set email = app.ActiveExplorer.Selection.item(1) Dim myExplorer As Explorer On Error Resume Next Set myExplorer = app.Explorers.Add(app.Session.GetDefaultFolder(olF olderInbox), olFolderDisplayNormal) Dim filter As String filter = email.Subject filter = Replace(filter, " ", "") filter = Replace(filter, "FW: ", "") filter = Replace(filter, "", "") filter = Replace(filter, "FW:", "") filter = Replace(filter, " (handled)", "") filter = Replace(filter, "(handled)", "") filter = Replace(filter, " (handling)", "") filter = Replace(filter, "(handling)", "") filter = Chr(34) + filter + Chr(34) On Error Resume Next myExplorer.Search filter, olSearchScopeAllFolders If Err.Number 0 Then MsgBox Err.Description Err.Clear myExplorer.Close Exit Sub End If myExplorer.Display End Sub ****************************** Any ideas? TIA, -- Eylon |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Instant Search, Advanced Find, Search Folders, and Windows Desktop | [email protected] | Outlook - General Queries | 2 | October 31st 08 06:37 PM |
Instant Search? | Candy | Outlook - General Queries | 6 | January 24th 08 08:45 PM |
SPEED: Instant Search vs. Search Folders | [email protected] | Outlook - General Queries | 0 | November 21st 07 03:18 PM |
Instant Search - | Brenda | Outlook - General Queries | 1 | August 7th 07 11:23 AM |
2007 search box and instant search invite, remove them | jeffrey | Outlook - General Queries | 2 | February 28th 07 04:08 PM |