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

Capture Inbound E-mail Subject with VBA



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 3rd 09, 04:08 AM posted to microsoft.public.outlook.program_vba
Brad
external usenet poster
 
Posts: 78
Default Capture Inbound E-mail Subject with VBA

I am just starting to experiment with Outlook VBA.

I am looking for a simple example of how to capture the content of an
inbound e-mail’s subject so that I can see it in VBA code.

For my first step, I would simply like to be able to do a MSGBOX to display
the captured Subject.

Thanks for your help,

Brad
Ads
  #2  
Old September 3rd 09, 08:04 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Capture Inbound E-mail Subject with VBA



What is an 'inbound e-mail's subject'?

This prompts the subject of the first selected item in the current folder:

Dim Sel as Outlook.Selection
Set Sel=Application.ActiveExplorer.Selection
If Sel.Count0 Then Msgbox Sel(1).Subject

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 2 Sep 2009 20:08:01 -0700 schrieb Brad:

I am just starting to experiment with Outlook VBA.

I am looking for a simple example of how to capture the content of an
inbound e-mail’s subject so that I can see it in VBA code.

For my first step, I would simply like to be able to do a MSGBOX to

display
the captured Subject.

Thanks for your help,

Brad

  #3  
Old September 3rd 09, 01:21 PM posted to microsoft.public.outlook.program_vba
Brad
external usenet poster
 
Posts: 78
Default Capture Inbound E-mail Subject with VBA

Michael,

Sorry, I didn’t explain very clearly what I am trying to do.

I have set up a little VBA module that is initiated by Outlook each time a
new e-mail arrives. It simply displays a message that control was passed to
it. This works nicely

I am now trying to capture the subject line of each e-mail and do something
with it in the VBA code.

Being new to Outlook VBA, I would like to see an example of how to get at
the subject line of each e-mail in VBA as they arrive.

Thanks for your help.

Brad




"Michael Bauer [MVP - Outlook]" wrote:



What is an 'inbound e-mail's subject'?

This prompts the subject of the first selected item in the current folder:

Dim Sel as Outlook.Selection
Set Sel=Application.ActiveExplorer.Selection
If Sel.Count0 Then Msgbox Sel(1).Subject

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 2 Sep 2009 20:08:01 -0700 schrieb Brad:

I am just starting to experiment with Outlook VBA.

I am looking for a simple example of how to capture the content of an
inbound e-mail’s subject so that I can see it in VBA code.

For my first step, I would simply like to be able to do a MSGBOX to

display
the captured Subject.

Thanks for your help,

Brad


  #4  
Old September 4th 09, 09:16 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Capture Inbound E-mail Subject with VBA



For instance, see the ItemAdd event of the Inbox folder. There's an example
in the VBA help file.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Thu, 3 Sep 2009 05:21:01 -0700 schrieb Brad:

Michael,

Sorry, I didn’t explain very clearly what I am trying to do.

I have set up a little VBA module that is initiated by Outlook each time a
new e-mail arrives. It simply displays a message that control was passed

to
it. This works nicely

I am now trying to capture the subject line of each e-mail and do

something
with it in the VBA code.

Being new to Outlook VBA, I would like to see an example of how to get at
the subject line of each e-mail in VBA as they arrive.

Thanks for your help.

Brad




"Michael Bauer [MVP - Outlook]" wrote:



What is an 'inbound e-mail's subject'?

This prompts the subject of the first selected item in the current

folder:

Dim Sel as Outlook.Selection
Set Sel=Application.ActiveExplorer.Selection
If Sel.Count0 Then Msgbox Sel(1).Subject

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 2 Sep 2009 20:08:01 -0700 schrieb Brad:

I am just starting to experiment with Outlook VBA.

I am looking for a simple example of how to capture the content of an
inbound e-mail’s subject so that I can see it in VBA code.

For my first step, I would simply like to be able to do a MSGBOX to

display
the captured Subject.

Thanks for your help,

Brad


  #5  
Old September 7th 09, 08:23 AM posted to microsoft.public.outlook.program_vba
Luc[_2_]
external usenet poster
 
Posts: 4
Default Capture Inbound E-mail Subject with VBA

On Thu, 3 Sep 2009 05:21:01 -0700, Brad
wrote:

Michael,

Sorry, I didn’t explain very clearly what I am trying to do.

I have set up a little VBA module that is initiated by Outlook each time a
new e-mail arrives. It simply displays a message that control was passed to
it. This works nicely

I am now trying to capture the subject line of each e-mail and do something
with it in the VBA code.



Try this:

Sub IncomingMailHandler(ThisMail as MailItem)
MsgBox ThisMail.Subject
End Sub


To "install" the script, create a new "run script" rule for incoming
messages in Tools / Rules and Alerts (if that isn't how you already did
it).
 




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
Initiate VBA as a result of inbound e-mail? Brad Outlook and VBA 1 August 30th 09 03:31 AM
Unwanted Inbound Mail Receipt Blake Kaos Outlook - General Queries 1 July 4th 08 08:15 AM
Capture group addresses from e-mail Big Willy Outlook - Using Contacts 1 May 11th 07 09:33 PM
Inbound mail is being copied to "My Documents" ?? steveb Outlook - General Queries 2 October 11th 06 11:33 PM
Whats this about the inbound and outbound... Chris Redfield Outlook Express 5 June 3rd 06 09:58 AM


All times are GMT +1. The time now is 12:55 PM.


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