Macro for Instant Search in new Window, failes Instant search



  • 1. Emails and Macros
    Hi, I am new to coding Outlook and have a quick question. Is it possible to attach VB code to an email and make it run when the recipient opens the message? I want to create an email that activates the recipients text-to-speech and automatically reads the mail to them? This is obviously to help me find my feet and for fun, but I am sure I can find a use for this kind of thing at work. Cheers, Steve.
  • 2. Custom Mail Fields
    Hi Guys I am using outlook to send emails from my delphi application. Is there anyway to create a couple of custom fields (with code), just for specific messages so I can store some ID's of customers from my application in the mail so I can see when those mails are sent? Thanks Ian
  • 3. Mail Account
    Is it possible to code Outlook XP to use a specific mail account to send email based on the Catagory set in the contact list? If so, where do I start? I have multiple email addresses and am forever forgetting to change the account when I send to mail lists. Perplexed
  • 4. An Easy Question: How to get a "msgbox" to display?
    Thanks, Michael. I was sure hoping for something simple. But since the concern is to move focus to Excel then we might not have to worry about getting back to Outlook. Thanks for the quick response....we will give it a try. Bernie

Re: Macro for Instant Search in new Window, failes Instant search

Postby RXlsb24 » Fri, 06 Feb 2009 00:51:22 GMT

hanks Ken,
I run it from the Tools menu -> Macro -> Macros. Guess it makes it a VBA
Tried your solution but it behaves the same (first time works, second
results in error, then must restart for normal GUI Instant search to work in
main window).

It does behave as expected if I run it from the GUI by right-clicking
Personal Folders in the Navigation Pane, Selectin Open in New Window, and
entering the search in the Instant Search box. With the macro I try to mimic
the same action.

Any other ideas?
Thanks again,

"Ken Slovak - [MVP - Outlook]" wrote:

Re: Macro for Instant Search in new Window, failes Instant search

Postby Ken Slovak - [MVP - Outlook] » Fri, 06 Feb 2009 04:10:26 GMT

Only other idea would be to display the new Explorer before running Search 
on it. Otherwise, no ideas other than using the original Explorer.

Ken Slovak
[MVP - Outlook]
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.

Re: Macro for Instant Search in new Window, failes Instant search

Postby RXlsb24 » Fri, 06 Feb 2009 17:44:09 GMT

Thanks again Ken, 
Displaying before did not help.

Anyone else have any ideas? 


Similar Threads:

1.Macro for Instant Search in new Window, failes Instant search (OL2

Hello Everyone, 

I wrote a Macro that takes the selected Email, removes some text from the 
subject (e.g. E:, 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 = 
    Dim filter As String
    filter = email.Subject
    filter = Replace(filter, "RE: ", "")
    filter = Replace(filter, "FW: ", "")
    filter = Replace(filter, "RE:", "")
    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
    Exit Sub
End If

End Sub

Any ideas?


2.Instant Search, Advanced Find, Search Folders, and Windows Desktop

Instant search stopped working for me.  Now if I search for even the
letter "a", I get the following message: No matches found for: "a".

When I ask "advanced find" to find any emails with categories contains
TNE01, it returns no results.  However, advanced find works somewhat.
For example when I look for items in my inbox with "a" in the subject
line, it returns 78 matches.

When I use "search folders", to find emails with categories = TNE01,
14 items are returned. When I use "search folders" to find items with
"WC" in frequently used text fields, it returns 765 items.

When I use Windows Desktop to search for TNE01 in email, nothing is
returned.  But Windows Desktop does search emails.  If I search for
WC, it returns 112 email items in "Personal Folders".

Earlier today it said it was done indexing... now instant search says
it has to index 12,155 items...

3.2007 search box and instant search invite, remove them

i don't want to see the search box, or the yellow bar asking me enable 
instant search. i didn't install instant search. i've heard nothing but bad 
things about it.

how do i get rid of the search box and yellow 'enable' box that sits over 
all the email messages, contacts, notes, etc. ?


4.SPEED: Instant Search vs. Search Folders

It seems that an instant search works faster than a search folder.
This seems crazy to me -- why would you set up a search folder if you
can find stuff faster with an instant search on the fly.  Is this just
how it works, or is something wrong iwth my outlook installation?

5.Instant search crashes when searching all folders

I wouldn't be posting this question if I'd found the answer here already.  
Instant search is one of the great features of Outlook 2007, in my opinion.  
Works great on my wife's computer, but only works on mine if I search one 
folder at a time.  If I chose to search all folders Outlook crashes.  Error 
reports lead nowhere on Microsoft's site.  Any help would be appreciated.  I 
use Vista Ultimate, Office 2007 PRO.  Latest updates for both.   And just 
reconfigured my entire computer 1 week ago, complete reformat and reinstall 
of all programs.  pst file at fault perhaps?



6. How can I clear recent search results in Outlook Instant Search

7. "instant search" stopped working in last few days "unable search"

8. Instant Search only searches in archive folder (outlook 2007)



Who is online

Users browsing this forum: No registered users and 19 guest