How To set your "File As" format to be uniform in Outlook Contacts

The problem with entering contact information on your Phone and Outlook and anything else that may be syncing with your contacts is that a lot of the time you end up with information they may not be entered in a uniform way.  The File As attribute is often one of these problems where some contacts are filed as "First Last" while others are filed as "Last, First".  The steps below will hopefully help you setup Outlook so it is uniform across all your contacts.

Step 1. Set Outlook to default to your preference.

  • In the Outlook Menu: Go to Tools -> Options -> Contact Options -> Set the Default "File As Order"

Step 2. Setup Security on Outlook to Allow for Unsigned Macros

  • In the Outlook Menu: Go to Tools -> Options -> Macros-> Security
  • Change the Security to "Warnings for All Macros"
  • Restart Outlook

Step 3. Installing the Code

  • In the Outlook Menu: Go to Tools -> Options -> Macros-> Visual Basic Editor
  • In the Left hand window double click on "ThisOutlookSession"
  • When a new windows titled "VBAProject.OTM - ThisOutlookSession" paste the following in:

Public Sub ChangeFileAs()
    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
                strFirstName = .FirstName
                strLastName = .LastName
                strFileAs = strFirstName & " " & strLastName
                .FileAs = strFileAs
            End With
        End If
    Set objOL = Nothing
    Set objNS = Nothing
    Set obj = Nothing
    Set objContact = Nothing
    Set objItems = Nothing
    Set objContactsFolder = Nothing
End Sub

Step 4. Saving the Code and Running the Macro

  • After you have pasted the code above into the windows titled "VBAProject.OTM - ThisOutlookSession" Click on File -> Save
  • Close the Visual Studio Window
  • Go to your Contacts Windows
  • Click on the Contacts Folder in Outlook
  • In the Outlook Menu: Go to Tools -> Options -> Macros
  • Select "ThisOutlookSession.ChangeFileAs" and Click on Run
  • After a about a minute depending on the number of contacts you have they will all be edited to display Contacts in the way you want.

Step 5. Change Security on Outlook back to not allow for Unsigned Macros

  • In the Outlook Menu: Go to Tools -> Options -> Macros-> Security
  • Change the Security to "Warnings for signed Macros, all other Macros are disabled"
  • Restart Outlook


  • To change the order of strLastName and strFirstName to change the File As. You can either use ", " or just a space: " " between the names in the highlighted part of the code.
  • This code works only on the default contacts folder.


The Sample code used here was obtained from the FileAs VBA Code sample from Slovaktech.

Comments (16)

  1. Serapolis says:

    Whenever I create a new contact on my pda, it default to "last name, first name", would it be possible to change the default setting to ‘first name last name"?

  2. RockAndRollBot says:

    This is FANTASTIC! I have been searching for something like this for years and have found no good solutions. Frankly, this shouldn’t be necessary because MS should have something for it…

    Thank you so much!

  3. Mason says:

    Thank you! This worked perfectly in Outlook 2007!  Very silly that Microsloth hasn't built this into Outlook.

  4. PatRick says:

    This was very helpful! Thank you very much. One correction. In my Outlook the Macro is not under Options. It's Tools -> Macros-> Security

  5. Emmett4 says:

    My File As cannot be changed.  Outlook 2007 bug.

  6. dieter says:

    Fantastic! This saves so much effort!

    My only qualm is the same as Patrick's!

  7. brad says:

    Am I the only one who's Outlook continuely crashes anytime this macro is run?

    I cannot get this thing to work!

    My security settings are set correctly, I've Enabled the unsigned macro, I've run it, and BANG (NOT RESPONDING) appears and my Outlook goes grey.

    I'm trying to re-organize the contacts for the CEO, and I certainly don't have the time to go through 6500 contacts to manually change the format, I was really hoping this would work…

  8. Morgan Tiley says:

    Wow that is really great. Thanks a lot!

  9. sue says:

    I didn't work for me, said there is an error!!! I agree that we shouldn't have to find a fix, microsoft should incorporate this sort of fix.

  10. Tim says:

    Worked perfect for me in Office 2007. Thanks for posting this. Only corrections are look for the macros under Tools > Macros

  11. Rodrigo D'Amico says:

    Hi, I used in Outlook 2010. Some options are in a different place, but worked like a charm. Saved me from spend some bucks.


  12. Sophia Green says:

    Fantastic! So pleased to finally have everything in order again! Thank you!

  13. Asir says:

    Really helpful and the instructions are really easy to follow. Thanks

  14. Binx says:

    Thanks, this has been driving me NUTS, well done to you: can’t understand why MS have not included this option!! is

  15. dhusker says:

    All of my contact Home addresses, were changed to Business Address. 1600 + contacts to change. Not good.

  16. Friedemari says:

    MS Outlook 7 – If I click on Visual Basic Editor (Step 3) it gives me error message "’VBE6EXT.OLB’ could not be loaded". Please help!

Skip to main content