• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Replace Display Names with Email Addresses

Slipstick Systems

› Developer › Code Samples › Replace Display Names with Email Addresses

Last reviewed on December 4, 2018     12 Comments

In a long thread discussing the problem of Outlook not showing the recipients email address at How to show email address not just name in From and To fields a user mentioned the steps he uses to get around this problem:

I need the full email address displayed when I print a sent email so that I can prove exactly what email address it was sent to. So instead of TO: 'John Doe' it will print out as john@domain.com. Right now when replying to an email, or starting a new one, I have to double click on 'John Doe ' and copy the full email address and paste it into the TO field. Otherwise it will print out as John Doe.

print header with names

Outlook uses the display name in the To/CC/BCC fields, getting it from the message you are replying to, or from the Email Display Name field in Contacts. Newer versions of Outlook will use Full Name (email@domain.com) as the display name format in Contacts but senders almost always use their name as the display name and don't include the email address. While newer versions of Outlook display the email address when you are composing mail, when the message is sent, only the display name is visible.

This specific problem is easy to solve using an ItemSend macro. Before the message is sent, the macro changes display names to the underlying email address. If the recipient entry contains an @ sign, it's skipped (remove the If/End If lines if you use @ signs in display names). It's completely automatic - as soon as you press Send, the display names are changed to the email address.

print header with addresses

December 4 2018: Updated macro to check for To, CC, and BCC and put the addresses in the correct field.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim Recipients As Outlook.Recipients
Dim R As Outlook.Recipient
Dim i, ToCC, newR

Set Recipients = Item.Recipients
For i = Recipients.count To 1 Step -1

Set R = Recipients.Item(i)
' if the entry is already an address, skip it
If InStr(1, R, "@") = 0 Then
ToCC = R.Type
Debug.Print R, ToCC
   Set newR = Recipients.Add(R.Address)
  newR.Type = ToCC
   Recipients.Remove i

End If

Next
Recipients.ResolveAll

End Sub

How to use the macro

First: You will need macro security set to low during testing.

To check your macro security in Outlook 2010 or above, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security. If Outlook tells you it needs to be restarted, close and reopen Outlook. Note: after you test the macro and see that it works, you can either leave macro security set to low or sign the macro.

Now open the VBA Editor by pressing Alt+F11 on your keyboard.

To use the macro code in ThisOutlookSession:

  1. Expand Project1 and double click on ThisOutlookSession.
  2. Copy then paste the macro into ThisOutlookSession. (Click within the code, Select All using Ctrl+A, Ctrl+C to copy, Ctrl+V to paste.)

More information as well as screenshots are at How to use the VBA Editor.

Replace Display Names with Email Addresses was last modified: December 4th, 2018 by Diane Poremsky

Related Posts:

  • Display the Recipient Email Address in the Sent Items Folder
  • How to view the BCC field on Sent messages
  • Move email items based on a list of email addresses
  • Remove an Address from Reply All

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Subscribe
Notify of
12 Comments
newest
oldest most voted
Inline Feedbacks
View all comments

Agus F
September 22, 2021 7:12 am

I try for outlook16, why did not effect.
Email address still not show, only display name is show

0
0
Reply
Alok
June 21, 2020 4:05 pm

I see from the thread description that the user needed email address in print. I had the same problem.This can be solved by using web outlook. There, the print option by default comes along with the email address.

0
0
Reply
Kirk
February 10, 2020 12:21 pm

Diane, this is excellent!

Is there a way to make this work on the From address?

0
0
Reply
Diane Poremsky
Author
Reply to  Kirk
June 21, 2020 10:32 pm

No, because the macro replaces display named with addresses when you send the mail - and depending on the account type, you either cannot override it (Exchange) or change change the display name in Account Settings.
 
If you want to add the From address to the message body when you reply, it is possible using a macro.

0
0
Reply
JAMES ORRELL
November 20, 2018 12:59 pm

I just tried this, works great except if some of the items are CC, they usually (not always) end up as TO.

Does that mean we need to have code for each of TO, CC, BCC?

0
0
Reply
Diane Poremsky
Author
Reply to  JAMES ORRELL
December 4, 2018 1:10 pm

It means you need to edit the code to check for the position.
Alt the best way to do it, this should work. (I didn't test it yet)

Set R = Recipients.Item(i)
' if the entry is already an address, skip it
If InStr(1, R, "@") = 0 Then
If R.Type = olTo then
   Recipients.Add R.Address
   R.Type = olTo
ElseIf R.Type = olCC then
   Recipients.Add R.Address
   R.Type = olcc
end if 
Recipients.Remove i

End If

0
0
Reply
Diane Poremsky
Author
Reply to  JAMES ORRELL
December 4, 2018 4:06 pm

I updated the macro with a version that checks for the position and puts the address in the correct field.

0
0
Reply
David
October 5, 2018 8:56 am

Hiya, I really love this idea, but I have a slight variation in terms of the scenario I'm facing, and I wonder if it might be possible to tweak this to cover.

We have a main office e-mail address (admin@) which is a distribution list that BCCs itself to a number of individuals, who collectively monitor the address. That's fine, but more often than not, the individual monitoring admin@ will then need to forward it to a colleague for action. Doing this means the original sender's e-mail address gets replaced with the display name, as part of the message body itself.

Would it be possible to tweak this macro so that, when *forwarding* e-mails, it replaces the display name with, in an ideal world, the following syntax :-

Display Name (e-mail address) ?

I appreciate it's a little out of left field, but your macro is so good and so *close* to what's needed, I thought I'd ask on the off-chance !

Thank you so much and, either way, you're the best =]]

!?!?! David !?!?!

1
0
Reply
Diane Poremsky
Author
Reply to  David
December 4, 2018 4:34 pm

Yes, it is possible. Rather than using the itemsend, it might be better to use a macro that looks at the Forward action.
https://www.slipstick.com/developer/code-samples/macro-reply-replyall-forward-file/
This should work to watch the Forward action. It assumes the message to the DL is From the person whose address you need. This line gets the proper DL name/address to use: Debug.Print "To:", sSentTo

Option Explicit
Private WithEvents oExpl As Explorer
Private WithEvents oItem As MailItem
Private bDiscardEvents As Boolean
   Dim oResponse As MailItem
  
Private Sub Application_Startup()
   Set oExpl = Application.ActiveExplorer
   bDiscardEvents = False
End Sub
  
Private Sub oExpl_SelectionChange()
   On Error Resume Next
   Set oItem = oExpl.Selection.Item(1)
End Sub
  
' Forward
Private Sub oItem_Forward(ByVal Response As Object, Cancel As Boolean)
   Dim sSentTo As String, SentFrom As String
 
   Cancel = True
   bDiscardEvents = True
 
Set oResponse = oItem.Forward

sSentTo = oItem.To
Debug.Print "To:", sSentTo
  If sSentTo = "Diane Poremsky" Then
  SentFrom = oItem.SenderEmailAddress
  Debug.Print "From:", SentFrom
  oResponse.Body = SentFrom & vbCrLf & oResponse.Body
 End If
    
oResponse.Display
     
   bDiscardEvents = False

Set oItem = Nothing

End Sub
'

1
0
Reply
Jesper Elkjaer
September 16, 2017 6:16 am

I have just tried this solution including setting the macro security level to low and restarting Outlook, but nothing seems to be different when sending emails. Is there anyway to troubleshoot this procedure that I can try?

0
-1
Reply
Kelly Lo
January 12, 2017 4:54 am

I am looking for another way...is only shown the display name without shown email address please? Thanks.

1
-2
Reply
Diane Poremsky
Author
Reply to  Kelly Lo
January 12, 2017 7:26 am

You only want to see the display name, not the address? You can't control it 100%, but if you change the email display name on controls to only have a name, if you choose a name from contacts, you won't see the address. You'll need to edit this field in the contact, either manually or using a macro. How the address is displayed in Replies will be decided by Outlook.

1
-3
Reply

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 30 Issue 29

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
  • Opening PST files in New Outlook
  • New Outlook: Show To, CC, BCC in Replies
  • Insert Word Document into Email using VBA
  • Delete Empty Folders using PowerShell
  • Warn Before Deleting a Contact
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Opening PST files in New Outlook

New Outlook: Show To, CC, BCC in Replies

Insert Word Document into Email using VBA

Delete Empty Folders using PowerShell

Warn Before Deleting a Contact

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2025 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.

:wpds_smile::wpds_grin::wpds_wink::wpds_mrgreen::wpds_neutral::wpds_twisted::wpds_arrow::wpds_shock::wpds_unamused::wpds_cool::wpds_evil::wpds_oops::wpds_razz::wpds_roll::wpds_cry::wpds_eek::wpds_lol::wpds_mad::wpds_sad::wpds_exclamation::wpds_question::wpds_idea::wpds_hmm::wpds_beg::wpds_whew::wpds_chuckle::wpds_silly::wpds_envy::wpds_shutmouth:
wpDiscuz

Sign up for Exchange Messaging Outlook

Our weekly Outlook & Exchange newsletter (bi-weekly during the summer)






Please note: If you subscribed to Exchange Messaging Outlook before August 2019, please re-subscribe.

Never see this message again.

You are going to send email to

Move Comment