Bulk Change Email Display Name Format

Last reviewed on July 24, 2014   —  68 comments

The default email display name in the address book used to be "Full Name (Email1)", "Full Name (Email2)", "Full Name (Email3)" but beginning with Outlook 2002, it was changed to "Full Name (email address)". If you upgraded from an earlier version of Outlook, your contacts may use a mix of display name formats. The code below will allow you to easily convert all contacts to a uniform format or remove the address for security reasons.

To change the File as format on existing contacts, see Bulk Change File As Format for Contacts. Our third "Bulk change Contacts" VBA sample is at Bulk Move Phone Numbers to a Different Phone Field.

The Name column (1) is controlled by the Address book setting. Column 2, the email Display Name, defaults to Full Name (email address) format. The code on this page will change this field.

Address book display names

To change the Name column (1) in Outlook 2007, the options for the Name column format is at Tools, Account Settings, Address book Tab, double click on the Outlook Address book and choose between Full name or File as format. In Outlook 2010, you'll start at File, Account Settings, Address book Tab, double click on the Outlook Address book. In Outlook 2003 or 2002, go to Tools, Email Accounts, View or Change existing directories or address books. Select Outlook Address Book and click Change to view or change the default for new contacts.

Note that when you edit a contact's email address, the display name is rewritten using Outlook's default format. You'll need to edit it before saving the contact.

While you can't change the default settings for the Display Name field (it always uses 'Full name (address)' format), you can use VBA to change your contacts so they all use the same format. Your choices are limited to Full name, Last First, FileAs, and Company. You can include the email address by adding this code to the format code: & " (" & .Email1Address & ")".

Default email display name format:
Email display name field on a contact

After running the VBA code below:
A contact after running the VBA code

When you click the To button, the entry in the Address book will now look like this:
Outlook 2010's address book, after running the VBA

Not up to working with VBA code? See Tools for tools that can make this change.

Two formats in the code sample below are less than useful as Display name formats:

strFileAs = .CompanyName & " " & .FullName & " (" & .Email1Address & ")"

Results in a leading space if the Contact does not have a Company listed.

'strFileAs = .FileAs

Uses only the Company name in the display name when the FileAs format is "Company name (Fullname)".

Note: I updated the code below to check for email addresses. If an address does not exist, the contact is skipped.

Outlook Hotmail Connector users should note that Hotmail requires the default 'full name (address)' format. As of Outlook Hotmail Connector 14.1, if you change the email display name in Outlook, the next sync will change it back to this format.

VBA Code to Change the Email Display Name

Press Alt+F11 to open the VBA editor then copy and paste into ThisOutlookSession. Uncomment the strFileAs line that uses the format you desire before running it.

This code was tested with Outlook 2010, 2007, and 2003. (May trigger the Email security prompts in Outlook 2003.)

If you have multiple contacts folders, ChangeEmailDisplayName_SelectedContacts will change the selected contacts. It checks for an email address (If .Email1Address <> "" Then) and only updates contacts with email addresses.

 
Public Sub ChangeEmailDisplayName()
    Dim objOL As Outlook.Application
    Dim objNS As Outlook.NameSpace
    Dim objContact As Outlook.ContactItem
    Dim objItems As Outlook.Items
    Dim objContactsFolder As Outlook.MAPIFolder
    Dim obj As Object
    Dim strFirstName As String
    Dim strLastName As String
    Dim strFileAs As String

    On Error Resume Next

    Set objOL = CreateObject("Outlook.Application")
    Set objNS = objOL.GetNamespace("MAPI")
    Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
    Set objItems = objContactsFolder.Items

    For Each obj In objItems
        'Test for contact and not distribution list
        If obj.Class = olContact Then
            Set objContact = obj

          With objContact
    
          If .Email1Address <>"" Then
            ' Uncomment the  strFileAs line for the desired format
            ' Add the email address to any string using
            ' the following code:
            ' & " (" & .Email1Address & ")"
                 
             'Firstname Lastname (email address) format
             ' strFileAs = .FullName & " (" & .Email1Address & ")"
                
             'Lastname, Firstname format
              strFileAs = .LastNameAndFirstName
                
             'Company name (email address) format
             ' strFileAs = .CompanyName & " (" & .Email1Address & ")"
                 
             'Comapany Firstname Lastname (email address) format
             'the display name will have a leading space if
             'the contact doesn't have a company name
             'strFileAs = .CompanyName & " " & .FullName & " (" & .Email1Address & ")"
                


             'File As format
             'Does not support Company (Fullname) format. 
             'Only Company name is used in the display name
             'strFileAs = .FileAs
                
             .Email1DisplayName= strFileAs

             .Save
           End If
          End With
        End If

        Err.Clear
    Next

    Set objOL = Nothing
    Set objNS = Nothing
    Set obj = Nothing
    Set objContact = Nothing
    Set objItems = Nothing
    Set objContactsFolder = Nothing
End Sub

Tools

ContactGenie Toolkit

ContactGenie Toolkit: 28 functions for Outlook 2000-2010 enabling changes to individual standard and custom fields; standardization for Message Class, CompanyName, FileAs, EmailDisplayAs, Fullname, and other fields; contact and NK2 info export; export contacts to CSV file; global changes for CompanyName, Company Address, Email and Web addresses. Preview/override any pending changes. Add Birthday/Anniversary/user-defined dates to default calendar. Personal Distribution Group management and more.

More Information

This code sample works on the Display name for the default email address (Email1) but can easily be changed to work with Email2 or Email3.

This code sample was created from Change Contact's File As format

Security consideration, from a discussion in TechNet forums:

Using the File As... format without (email address) displayed, when people forward emails, messages will not contain the email address visible for others, just the display name, or not accessible for worms or other user's mailbox attackers.

Written by

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.

Please post long or more complicated questions at Outlookforums.

68 responses to “Bulk Change Email Display Name Format”

  1. Rob

    Worked perfectly for me in Outlook 2010. Thanks!

  2. John Walker

    Fantastic,

    All my Gmail syncing had somehow made all my display as fields to say "home". This little program fixed me right up.

    Thanks,

    John

  3. Cynthia

    This was very helpful for one Contact list. I have 4 email accounts in my Outlook 2010. How do I change the Display As for the other Contact folders. This only changed the first (defaul?) folder.

  4. Jeff Lloyd

    After I delete the apostrophe from in front of the strFileAs = of strFileAs = .FullName & " (" & .Email1Address & ")" I get an error: Compile error: Expected: end of statement. Any thoughts?

  5. Jeff Lloyd

    Wow, that was a quick response! Let me know when the code is fixed and I'll try it again. I just tried it a minute ago because it looked like the code had changed, but I was still getting an error (different error): Compile Error: Syntax Error and it highlights the following lines: Public Sub ChangeEmailDisplayName() -- highlighted in yellow, and Set objOL = CreateObject("Outlook.Application") -- simply outlined. Do you know what the fix is for that?

  6. Jeff Lloyd

    Worked like a charm! Thanks so much for everything. I can't tell you how frustrated I've been with Outlook since I reinstalled it on my computer last year. I found this site yesterday, and I've now run two of your scripts; I'm now happy with my email again.

  7. Art

    How do I display only the email address in the "display as field."

  8. Jessie

    Technologically challenged person asking for baby steps here. After I get to the VBA editor, what exactly am I copying and pasting into ThisOutlookSession? Am I copying and pasting all of your lines above including the green ones? I want to display the first and last name only. Which lines do I uncomment and how do I uncomment them? By deleting them? Thank you

  9. robin

    I simple way to do this that some people my be more comforable with is this - export all the contacts to Excel. May any change youu want, then import the excel document as 'replace.

  10. Chris

    Hi Diane, Great code. I am looking for a similar code that updates the inbox items. e.g. I have a mailitem with "max@email.com" and a contactitem with the matching address with .DisplayName = "Max". The code should cache the contacts, than parse the mailitems and update the mailitem.Displayname accordingly. By chance you don't know such code, do you? Rgds, Chris

  11. Chris

    Tanks for your quick reply.

  12. Brenda Morgan

    OMG this was invaluable! I went nuts trying to find a MS solution. Thank you so much for writing this.

  13. Tiffany Sawyer

    I'm also a little challenged when it comes to code. Maybe a stupid comment but I don't have an F11 key... how or what should I select? I would like for all my contacts email addresses to be displayed by company name. thanks for your help!

  14. Lewis

    This worked absolutely perfectly, thank you so much!!!!!

  15. MS

    Awesome! Thanks!

  16. W

    This works great, but won't work on emails sent. E.g if you sent it to Tom Brown (whose email address is tbrown@whatever.com) Whilst it will change the contact, it won't change the email address on an old email you open and print :( Bit silly if you print it out and want to know what TBrown's email address was.

  17. MS

    I use Outlook 2013 and always use to wonder if there could be a code available to replace the name of the sender (Display Name as your said) with the 'File As' in my address book, so that when I group the mails in a folder by the name, I can easily analyse whatever I need.

    If the sender has not properly configured his email account (or has done in haste) in his mobile device or so, he wouldn't have configured the 'Send as' format and the mobile device' settings would have been configured by default to send the mail as 'Email Address (Email Address)' instead of 'Full Name (Email Address)'.

    I write codes in Outlook but I am more of an amateur only and unaware of what property of a mail item it is and how I look up for the email address in my address book to find the respective 'File As' to replace the same in the mail item's property.

    I would use the same code to modify the existing mails in the folders too. Thanks!

  18. Jim Wimberly

    Worked perfect for me for Outlook 2010. I preferred Firstname Lastname as my display, so I "un-rem'd" that sentence in the code and rem'd out the Lastname, Firstname section. Excellent resource. thank you.

  19. David

    Hi! Is there any option or work around for Outlook Hotmail Connector users? Cheers.

  20. Jeff Squires

    Diane this is a wonderful piece of code. I'm running Outlook 2013 and it took seconds for your code to make every "display as" field perfectly uniform. This problem has been bugging me for years! Now when I start typing a contact name in an email, Outlook immediately resolves the name properly after a few letters. THANK YOU!!

  21. George

    This is my first encounter with VBA. I have everything set up to run, but when I click run, I get "invalid Procedure Error." I have no idea how to run or intiate this macro. Would you please advise?
    Thanks,
    George

  22. George

    Diane,
    I sent to you two emails this past weekend seeking help with this macro. I was able to get the macro to run this evening. So I don't think I will need that help. The copy button at the top of the macro that you mentioned in one of your earlier responses did not appear on for me. SO when I copied and pasted the macro code, it went into the
    vba program in the wrong layout. That was the source of my problem. It took me considerable time to figure it out and to remedy the problem. Once I fixed it, the macro ran very quickly and did a very nice job.
    Thanks,
    George

  23. John

    I like it. Would it be hard to count the changes?

  24. Clark

    Hi, I have used this in Outlook 2013 and work great on a contact list under my email address. I also have a Public contact list and it doesn't work on that, what do i need o change so i can write a separate Macro for the Public contacts, is there a way of doing this. Thank you so much for your help, this Macro is fantastic at keeping uniform control over a large set of contacts, I really appreciate the help.

  25. Clark

    Hi, I have tried the Macro for Outlook 2013 for "Bulk Change File As Format for Contacts" and it works across all contact groups including Public. Can this macro be reworked to bring up the same set of options 1 to 8 but be applied to the "Email Display Name" field instead? This would solve all my problems. I have undertaken a trial of ContactGenie but they do not have to Option "Company, Full Name". Thank you kindly for your assistance. Clark

  26. Graham

    I am trying to run your script and receive the following error "macros in this project are disabled"

    I am using Outlook 2010 with Office 365

  27. Graham

    Diane

    Thank you that has worked a treat

    Regards

    Graham

  28. chrisbrace

    this worked perfectly, very very useful, thanks. Note I did edit slightly to put angle brackets around the email address instead of curved brackets, this fixed my bouncing email issue caused by outlook 2013 misinterpreting the curved brackets around an email address in the display name and failing to treat it as an email address.

    It does not explain why outlook insists on ignoring the actual email address in its own contact and instead trying to parse the display name to extract the email address!

  29. Graham

    Diane

    Is there anyway to remove "mr" or "mrs" from a name.

    Not all instances of a contact have been added with these and wanted to delete so the fields are consistent

  30. Graham

    Diane

    Thank you for the reply

    Do I just amend code to look like this

    Public Sub ChangeEmailDisplayName_Anyfolder()
    Dim Session As Outlook.NameSpace
    Dim currentExplorer As Explorer
    Dim Selection As Selection
    Dim currentItem As Object
    Dim folder As Outlook.folder

    Dim obj As Object
    Dim strFirstName As String
    Dim strLastName As String
    Dim strFileAs As String

    Set currentExplorer = Application.ActiveExplorer
    Set Selection = currentExplorer.Selection

    On Error Resume Next

    For Each obj In Selection
    Set folder = currentItem.Parent
    'Test for contact and not distribution list
    If obj.Class = olContact Then
    Set objContact = obj

    With objContact
    If Left(LCase(.Title), "m") Then
    .Title = ""
    .Save
    End If
    End With

    End If

    Err.Clear
    Next

    Set Session = Nothing
    Set currentExplorer = Nothing
    Set obj = Nothing
    Set Selection = Nothing
    Set currentItem = Nothing
    Set folder = Nothing
    End Sub

    If so I get a "cant execute code in break mode error"

  31. Graham

    Diane

    Thankyou that has now worked as you say it must have been the break

    The only downside is that I will have to run the "files as" & "email display as" scripts again as these fields do not up date. I presume this is because we are just removing the "Mr" and Outlook doesn't see this as actually editing the record

    Is there any way to actually save the scripts so they can be used in future without having to create them each time?

    Regards

    Graham

  32. Graham

    Diane

    Would the scripts have to be in order i.e remove title before the others otherwise the titles would still be listed in the file as and display as

  33. clark

    Hi, I want to add an option that deals with missing fields. For example if there is no first or last name and only a company or vice versa. Of fields are missing I end up with brackets where I don't want them Example: Hybrid (Clark) is company (first name) but if there was no Company I would end up with (Clark). Is there a way to get the code to look at the company and if it is not there remove the brackets? Also can I wrote the code to return the fit two words of a Company name instead of the whole name? Thank you for your help
    Clark

  34. John

    It's John again; I asked about counting the changes and it worked. Now I want to delete duplicate email addresses--I seem to have a lot. After your "With ObjContact" statement above, I add the following:
    'Delete Duplicate Email Addresses
    If .Email1Address = .Email2Address Then
    .Email2Address = ""
    End If
    It finds the duplicates but it does not erase them. What am I missing about 'blank' values?
    Thanks.

  35. Adrian Emanuel

    Hi Diane - sorry total newbie to VBA code here. I want to change all of my contact's display names into the last name, first name format. I have copied the code above into ThisOutlookSession but not sure how to run it - what are the steps i need to take to make these changes?

    Thanks very much in advance

  36. Jake Walker

    Hi Diane,

    I currently have a user who has 2000+ contacts which need the display name updated. I have been looking at your script but am having some trouble running it. I have opened Microsoft Visual Basic using Alt + F11 then pasted it into TheOutlookSession within the project window. However I believe I'm doing something wrong. Can you please check if my script is correct? Also will this update the File As field? I would like the display contacts to show as First Name, Last Name, Email Address please.

    Public Sub ChangeEmailDisplayName()
    Dim objOL As Outlook.Application
    Dim objNS As Outlook.NameSpace
    Dim objContact As Outlook.ContactItem
    Dim objItems As Outlook.Items
    Dim objContactsFolder As Outlook.MAPIFolder
    Dim obj As Object
    Dim strFirstName As String
    Dim strLastName As String
    Dim strFileAs As String

    On Error Resume Next

    Set objOL = CreateObject("Outlook.Application")
    Set objNS = objOL.GetNamespace("MAPI")
    Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
    Set objItems = objContactsFolder.Items

    For Each obj In objItems
    'Test for contact and not distribution list
    If obj.Class = olContact Then
    Set objContact = obj

    With objContact

    If .Email1Address <> "" Then
    ' Uncomment the strFileAs line for the desired format
    ' Add the email address to any string using
    ' the following code:
    ' & " (" & .Email1Address & ")"

    'Firstname Lastname (email address) format
    ' strFileAs = .FullName & " (" & .Email1Address & ")"

    'Lastname, Firstname format
    strFileAs = .LastNameAndFirstName

    'Company name (email address) format
    ' strFileAs = .CompanyName & " (" & .Email1Address & ")"

    'Comapany Firstname Lastname (email address) format
    'the display name will have a leading space if
    'the contact doesn't have a company name
    'strFileAs = .CompanyName & " " & .FullName & " (" & .Email1Address & ")"

    'File As format
    'Does not support Company (Fullname) format.
    'Only Company name is used in the display name
    'strFileAs = .FileAs

    .Email1DisplayName= strFileAs

    .Save
    End If
    End With
    End If

    Err.Clear
    Next

    Set objOL = Nothing
    Set objNS = Nothing
    Set obj = Nothing
    Set objContact = Nothing
    Set objItems = Nothing
    Set objContactsFolder = Nothing
    End Sub

    Kind Regards
    Jake Walker

  37. Jake Walker

    Hi Diane,

    Where do I add this? Is my script correct? Am I running it correctly also?

    Could you give me a call to discuss this further?

    Kind Regards
    Jake Walker

  38. Jake Walker

    Hi Diane,

    I got everything working. Thank you for your help.

    Kind Regards
    Jake Walker

Leave a Reply

If the Post Coment button disappears, press your Tab key.