Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Get Sender of a message (http://www.outlookbanter.com/outlook-vba/7508-get-sender-message.html)

Marcus O. M. Grabe February 25th 06 12:41 AM

Get Sender of a 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.

Sue Mosher [MVP-Outlook] February 25th 06 12:52 AM

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.



All times are GMT +1. The time now is 12:38 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-2006 OutlookBanter.com