Last reviewed on May 7, 2015   —  76 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

More Articles at Slipstick.com:

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.


Comments

  1. John Walker says

    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

  2. Cynthia says

    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.

  3. Jeff Lloyd says

    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?

  4. Jeff Lloyd says

    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?

    • Diane Poremsky says

      I'll check the code after and see if i can repro. Synxtax error means something is still not right in the code.

    • Diane Poremsky says

      I missed fixing 4 & quot; - they are double quotes. Fixed now. (this is the one big negative against wordpress.)

  5. Jeff Lloyd says

    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.

    • Diane Poremsky says

      You can't set that as a default format and you can't use it with hotmail accounts. You'll need to fix each contact as you create them and use the macro to change it for all existing ones.

      to change it using the macro, use strFileAs = .Email1Address

  6. Jessie says

    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

    • Diane Poremsky says

      At the top right of the Code block is a small toolbar that pops up when you hover over the code. Click the Copy button to copy the code. Paste it into ThisOutlookSession.

      The green lines can stay or go - they are commented out. Remove the ' from in front of the line you want to use. You can certainly delete the lines you aren't using, but it's not necessary as long as they are green.

      For First Last, you would use
      strFileAs = .Firstname & " " & .Lastname

      if you use strFileAs = .FullName, you'd get the middle initial too.

  7. robin says

    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.

    • Diane Poremsky says

      It might be more comfortable for some users but if you customized business cards or added user photos to contacts, importing changes from Excel will remove the images. Exporting/importing has the potential to change formatting in the notes field and remove attachments. If you don't use formulas to change the display names, it will take a lot longer than the macro.

  8. Chris says

    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

  9. Tiffany Sawyer says

    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!

    • Diane Poremsky says

      You should have an F11 function key - function keys are usually the top row of buttons on the keyboard. But depending on your computer, the keys may be used for something else, like adjusting the volume, dimming the screen, etc., unless you press a function button too.

  10. W says

    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.

    • Diane Poremsky says

      Correct, this only applies to the display name format in Contacts, not email. The email gets the display name from the sender and is not affected by the contact's display name format. Did you try hitting Forward (or Reply) then printing the draft copy? In newer versions of Outlook, this should include the email addresses, if not, you could add them - if you need to do it often, a macro can get the address from the message and insert into the draft.

  11. MS says

    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!

  12. Jim Wimberly says

    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.

  13. Jeff Squires says

    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!!

  14. George says

    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

  15. George says

    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

    • John says

      Great, thanks. Then I can find out what is making the change. I sync my Galaxy S3 cellphone with Outlook through Kies 3. The switch is set to not change Outlook contacts ... I just don't believe it!

    • John says

      After a minor tweak it worked like a charm. I needed a test for the current value; otherwise, it was changing all of them. Thanks.

  16. Clark says

    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.

  17. Clark says

    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

  18. Graham says

    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

  19. chrisbrace says

    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!

  20. Graham says

    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

    • Diane Poremsky says

      You can use the following in the code instead of changing address fields, you'll change the title. It assumes you want to remove Mr, Ms, Mrs but keep other titles. If you want to remove all titles, remove the If and End if lines.

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

  21. Graham says

    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"

    • Diane Poremsky says

      yes, that is correct - just tested it on some test contacts i imported that had titles that were annoying me. :)

      You have a break entered - is there a red dot in the margin? click it to remove it.

  22. Graham says

    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

    • Diane Poremsky says

      Do you want to run them automatically? They need a trigger, like a task reminder. If you just want them around, ready to use, don't delete them from the VBA editor. Click Save when you close Outlook and are asked about saving the VBA.

      You can combine all 3 changes into one macro
      With objContact

      strFileAs = .LastNameAndFirstName

      .FileAs = strFileAs

      If .Email1Address <>"" Then
      .Email1DisplayName= strFileAs
      End if

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

      .Save
      End With

  23. Graham says

    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

    • Diane Poremsky says

      Yes, I think - because most of the name formats include the title. I'd probably stick the .save back in after the title is removed, just to be sure the right value is read.

  24. clark says

    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

    • Diane Poremsky says

      you can use if statements - something like
      if .company = "" then
      ' use full name
      else
      ' use this
      end if

      Doing two words is also possible. You need to find the second space and use that to get the company name. This isn't hard using instr, len, and left functions. Longish but not difficult. You need to decide if you want to limit the length of names with only 1 space or use the full name - or better yet, only limit the company name if more than nn characters. This eliminates issues with "A D Smith Inc" getting chopped to A D.
      if .companyname > 30 then
      If ' get the position of second space. if over 30, chop
      else
      'if under 20, get 30 characters
      end if
      end if

  25. John says

    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.

    • Diane Poremsky says

      Are you saving the contact before moving on to the next one?
      If .Email1Address = .Email2Address Then
      .Email2Address = ""
      .Save
      End If

  26. Adrian Emanuel says

    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

  27. Jake Walker says

    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

    • Diane Poremsky says

      This will apply to the File as field name.

      Do you get any error messages? Any red lines? Is macro security set to the lowest level?

    • Jake Walker says

      Hi Diane,

      I haven't set the macro security to low. is there anyway to update the display names also?

      Kind Regards
      Jake

    • Diane Poremsky says

      You can add
      .Email1DisplayName = [desired format]
      to the macro.
      email2 and 3 have their own displayname fields as well.

  28. Jake Walker says

    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

    • Diane Poremsky says

      This will use the File as name and the email display name as their full name.

      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
      'Lastname, Firstname format
      strFileAs = .FullName
      .FileAs = strFileAs
      .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

  29. Stu says

    Mahalo (thank you) for the code. This is exactly what i was looking for. However, for reasons beyond me..i can't seem to get the macro to run. I have Outlook 2013, macros are enabled. I copied and pasted the code into "ThisOutlookSession". I attempted to run the code "As-Is", but nothing happens. I also edited to reflect
    strFileAs = .LastNameAndFirstName & " (" & .Email1Address & ")"

    I also went through your tutorial and still can't get it to run. No error messages or prompts.

    I would really appreciate your assistance..
    Reply

  30. George Jaajaa says

    Are you able to create a code so that the display name is first name last name, rather than last name, first name

    • Diane PoremskyDiane Poremsky says

      You'd use = .firstnanme & " " & .lastname
      if either field a blank, you'll have a leading or ending space. There is no way to avoid it without using some if statements.

  31. Stu says

    Mahalo for responding. thanks to your suggestion i was able to determine what was wrong. I was actually using the vba code to change email display name for multiple contact folders. I assumed that by just selecting the contacts folder that needed to be corrected, when i run the macro it would do as intended, however I realized by the error code, i had to actually select the individual contacts (i selected all the contacts in that specific folder), then the macro did its intended job....

    I again, would like to thank you for your excellent dedication and taking the time to help me and the many others that you have helped here!

  32. Dan says

    Hello Diane, would you know how I can change the Display Name for the person I am replying to at the time I click the send button? I can use the ItemSend event but which object and which property do I change. I am pretty new to VBA so any help you can provide would be much appreciated.

    • Diane PoremskyDiane Poremsky says

      I'm not sure I understand what you want to do (or why). You want to change their display name in the email message or in their contact?

Leave a Reply

Please post long or more complicated questions at OutlookForums by Slipstick.com.

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