A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to write a macro to search inbox for certain numbers



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 17th 09, 11:03 PM posted to microsoft.public.outlook.program_vba
jabri
external usenet poster
 
Posts: 2
Default How to write a macro to search inbox for certain numbers

Never written a macro in outlook before.
I'm sure this is pretty basic.
How would I write code to highlight everything in my inbox and search for
45678.
I would then take all of those emails and copy them to another folder and
then do another search for 45679 and do the same thing over and over with a
list of numbers. I would have to modify the list daily from an excel file.

Is this possible?
Ads
  #2  
Old August 18th 09, 07:18 AM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default How to write a macro to search inbox for certain numbers

It's actually pretty simple, one line of code:

ActiveExplorer.Search("My search text",
Outlook.OlSearchScope.olSearchScopeCurrentFolder)

See the developer reference for more information:

Search Method [Outlook 2007 Developer Reference]:
http://msdn.microsoft.com/en-us/library/bb220302.aspx


--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jabri" wrote:

Never written a macro in outlook before.
I'm sure this is pretty basic.
How would I write code to highlight everything in my inbox and search for
45678.
I would then take all of those emails and copy them to another folder and
then do another search for 45679 and do the same thing over and over with a
list of numbers. I would have to modify the list daily from an excel file.

Is this possible?

  #3  
Old August 18th 09, 04:07 PM posted to microsoft.public.outlook.program_vba
jabri
external usenet poster
 
Posts: 2
Default How to write a macro to search inbox for certain numbers

So to be very step by step
just have my inbox open
Go to Tools/Macro/Macros
Macro name =test
Create

Sub test()
ActiveExplorer.Search("45678",
Outlook.OlSearchScope.olSearchScopeCurrentFolder)
End Sub


"Eric Legault [MVP - Outlook]" wrote:

It's actually pretty simple, one line of code:

ActiveExplorer.Search("My search text",
Outlook.OlSearchScope.olSearchScopeCurrentFolder)

See the developer reference for more information:

Search Method [Outlook 2007 Developer Reference]:
http://msdn.microsoft.com/en-us/library/bb220302.aspx


--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"jabri" wrote:

Never written a macro in outlook before.
I'm sure this is pretty basic.
How would I write code to highlight everything in my inbox and search for
45678.
I would then take all of those emails and copy them to another folder and
then do another search for 45679 and do the same thing over and over with a
list of numbers. I would have to modify the list daily from an excel file.

Is this possible?

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Write Rules Stratuser Outlook and VBA 4 June 23rd 09 11:40 PM
How do you write a macro to automatically import and map a calenda Dave L Outlook and VBA 4 September 30th 07 02:02 AM
write macro for toolbar? Penny Miller Outlook - Using Forms 11 December 21st 06 07:33 PM
Read Subject from Inbox and write into Excel Avadivelan TCS Outlook and VBA 1 November 11th 06 09:49 AM
$$ looking for someone to write a macro for me [email protected] Outlook and VBA 0 March 16th 06 12:24 AM


All times are GMT +1. The time now is 08:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.