View Single Post
  #2  
Old February 25th 06, 12:52 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Get Sender of a message

In Outlook 2003, you can use the MailItem.SenderEmailAddress, but note that it's subject to security prompts.

In earlier versions, there is no Outlook property that returns the sender's email address. You can either use CDO (or Redemption to avoid security prompts -- http://www.dimastr.com/redemption/) to get the From address or use Outlook to get the Reply To address. Sample code at http://www.outlookcode.com/d/code/getsenderaddy.htm

To get the SMTP address from an Exchange sender or recipient, use CDO or Redemption and the PR_EMAIL (&H39FE001E) MAPI property to obtain the SMTP address from the AddressEntry object. See http://www.outlookcode.com/d/code/ge...htm#redemption and http://www.cdolive.com/cdo5.htm#EMailAddressOfSender for examples.

a) when the message is opened


Application.ActiveInspector.CurrentItem

b) when the message is just marked is the list of msgs?


Application.ActiveExplorer.Selection(1)
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Marcus O. M. Grabe" wrote in message ...
Hi all,

I normally do programming VBA within Excel or Word or just VB itself,
so I do not know the objects in Outlook.

How can I get the sender of a message
a) when the message is opened
b) when the message is just marked is the list of msgs?

Thanks for any help,

Marcus.

Ads