How to write a macro to search inbox for certain numbers

  • Thread starter Thread starter jabri
  • Start date Start date
Status
Not open for further replies.
J

jabri

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?
 
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 - , MCDBA, MCTS (SharePoint programming, etc.)

"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?
 
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 " 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 - , MCDBA, MCTS (SharePoint programming, etc.)
>

>

>

> "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?
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Is it possible to write a macro to email to all addresses of selected contacts? Using Outlook 1
F Can I write a macro that triggers off an Outlook alert Outlook VBA and Custom Forms 1
P Possible to write a macro to print all attachments with specific . Outlook VBA and Custom Forms 1
S Macro to Write Rules Outlook VBA and Custom Forms 4
T Customized form: The Forward option shows write layout Outlook VBA and Custom Forms 0
F VBA code to dock Styles whenever I write or edit an email Outlook VBA and Custom Forms 0
A Read and Write to Text File Outlook VBA and Custom Forms 1
F VBA routine to write new sub routine in outlook Outlook VBA and Custom Forms 0
D How Would I Write This Filter? Using Outlook 3
M how do I write a plug in to send messages to a web app? Outlook VBA and Custom Forms 1
E RE: How do i write a letter to a business contact BCM (Business Contact Manager) 1
P Write a tool to generate a PST file with the same structure as old Outlook VBA and Custom Forms 1
B Write code for a button on New Form Outlook VBA and Custom Forms 1
S write and format a piece of text in the body using vba Outlook VBA and Custom Forms 7
S Write custom text in outlook infobar Outlook VBA and Custom Forms 1
A How to write into outlook status bar. Outlook VBA and Custom Forms 1
Q Outlook become non responsive if i write outlook item in bulk Outlook VBA and Custom Forms 20
V Outlook 2007: How to read/write Out-of-Office settings Outlook VBA and Custom Forms 3
M What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Obje Outlook VBA and Custom Forms 1
M What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Obje Outlook VBA and Custom Forms 5
N Macro in this Project are disabled Outlook VBA and Custom Forms 0
M Outlook 365 Amending code so macro runs within current new mail window Outlook VBA and Custom Forms 0
M Outlook 365 macro - automatically attach file based on subject line Outlook VBA and Custom Forms 0
J Outlook macro to run before email is being send Outlook VBA and Custom Forms 0
H Macro to Delete Duplicate items in Outlook calendar where title is the same and date is the same Outlook VBA and Custom Forms 0
X Custom icon (not from Office 365) for a macro in Outlook Outlook VBA and Custom Forms 1
X Run macro automatically when a mail appears in the sent folder Using Outlook 5
mrrobski68 Issue with Find messages in a conversation macro Outlook VBA and Custom Forms 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
M Use Macro to change account settings Outlook VBA and Custom Forms 0
J Macro to Reply to Emails w/ Template Outlook VBA and Custom Forms 3
C Outlook - Macro to block senders domain - Macro Fix Outlook VBA and Custom Forms 1
Witzker Outlook 2019 Macro to seach in all contact Folders for marked Email Adress Outlook VBA and Custom Forms 0
S macro error 4605 Outlook VBA and Custom Forms 0
A Macro Mail Alert Using Outlook 4
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
J Macro to send email as alias Outlook VBA and Custom Forms 0
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro GoTo user defined search folder Outlook VBA and Custom Forms 6
D Outlook 2016 Creating an outlook Macro to select and approve Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro to check Cursor & Focus position Outlook VBA and Custom Forms 8
V Macro to mark email with a Category Outlook VBA and Custom Forms 4
M Outlook 2019 Macro not working Outlook VBA and Custom Forms 0
S Outlook 365 Help me create a Macro to make some received emails into tasks? Outlook VBA and Custom Forms 1
D Auto Remove [EXTERNAL] from subject - Issue with Macro Using Outlook 21
V Macro to count flagged messages? Using Outlook 2
sophievldn Looking for a macro that moves completed items from subfolders to other subfolder Outlook VBA and Custom Forms 7
S Outlook Macro for [Date][Subject] Using Outlook 1
E Outlook - Macro - send list of Tasks which are not finished Outlook VBA and Custom Forms 3

Similar threads

Back
Top