Display the Sender Address in Outlook 2000

This macro enables you to get the sender's address even in older versions of Outlook.

Last modified: 2006/05/05 | Accessed: 55.900  | #24
◀ Previous sample Next sample ▶
Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules.

Before Outlook 2003 it wasn't possible to get the email address of the sender via the Outlook object model. The Sender property back then showed the display name instead.

See how to get the address by using the Redemption. The macro adds a user property named 'SenderAddress', which you can add to the fields displayed in the inbox.

tip  How to add macros to Outlook
Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
  Set Items = Application.GetNamespace("MAPI") _
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
  If TypeOf Item Is Outlook.MailItem Then
    AddSenderEmailAddress Item
  End If
End Sub

Private Sub AddSenderEmailAddress(Mail As Outlook.MailItem)
  On Error Resume Next
  Dim rdItem As Object
  Dim Field As Outlook.UserProperty

  Set rdItem = CreateSafeItem(Mail)

  Set Field = Mail.UserProperties("SenderAddress")
  If Field Is Nothing Then
    Set Field = Mail.UserProperties.Add("SenderAddress", olText, True)
  End If

  Field.Value = rdItem.SenderEmailAddress

  ReleaseSafeItem rdItem
End Sub
OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.
email  Send a message