Last reviewed on May 7, 2015   —  111 Comments

Applies to Microsoft Outlook 2016, 2013, 2010, 2007, 2003, 2002, 2000

I call this my "super-duper bulk contacts changer" code because it's so easy to modify to use with other contact fields. Customize the code yourself or use the "Bulk change Contacts" VBA samples at Move Phone Numbers to a Different Phone Field and Change Email Display Name Format. Want to change the FileAs field in all contacts to match the setting in Options? I have a macro for that too: Change FileAs format to match Outlook's default setting. If the first and last names are in the wrong fields, use this macro to swap them: Swap First and Last Name Fields

To change the default File As format used for new contacts, go to Tools, Options, Contacts options in older versions or File, Options, Contact options in Outlook 2010 and 2013.

Change the default format in Contact Options

Outlook's Contact's offer a number of File As formats and this format can be used for the contact's name display in the Address Book. However changing the File As format on a large number of contact's is time-consuming when you need to change the contacts one by one. You can do it using VBA or a utility (listed below).

Change the FileAs format in Outlook's Contacts

The file as format options are shown in the screenshot. The VBA code sample supports all 5 formats.

Along with changing the File As order, you can change the order Outlook assumes you use when you enter the name. This setting determines how the names populate the dialog when you press the Full name button. If the name order is wrong in FileAs ("Mary, Smith" when using last, first format), check this setting. If you choose Last First format you don't need to use a comma to separate the names when you enter them and First Last1 Last2 correctly puts the name in the middle position into the last name field, not the middle name field. Outlook will detect names separated by commas as Last, First format, regardless of the Fullname format setting.

VBA Sample

The following code sample supports all 5 File As formats available in Outlook. 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. (Uncomment the line by removing the apostrophe from in front of the strFileAs = [name_format] command you wish to use.)

See page 2 (or the text file below) for code sample 2 to change the FileAs format on selected contacts. (Tested in Outlook 2010.)

To test for a value (such as Company name) and use a different File As format if the value is empty, you need to use an If... Then statement.

            With objContact
                If .CompanyName = "" Then
            ' Firstname Lastname format
                   strFileAs = .FullName
            ' Company name only
                   strFileAs = .CompanyName
               End If
               .FileAs = strFileAs
            End With

See Bulk change FileAs format to match Outlook's default setting for a version of this macro that reads the default setting in the registry and applies it to existing contacts.

Run Macro button or press F5To use, select the Contacts folder in Outlook then return to the VBA Editor and press the Run button or F5 to run the macro. You can run the macro later by pressing Alt+F8 (after selecting the Contacts folder) then choosing the macro and pressing Run.

To help eliminate errors, we have text files containing the VBA code samples available. To use, open the text file and Select all (Ctrl+A), copy then paste into the VBA editor. To save to your computer, right-click and choose 'Save Target as'.
Original code - change contacts in default folder | Change selected contacts in any folder

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
            ' Uncomment the  strFileAs line for the desired format
            ' Comment out strFileAs = .FullName (unless that is the desired format)

                'Lastname, Firstname (Company) format               
                ' strFileAs = .FullNameAndCompany 
                'Firstname Lastname format
                 strFileAs = .FullName
                'Lastname, Firstname format
                ' strFileAs = .LastNameAndFirstName
                'Company name only
                ' strFileAs = .CompanyName
                'Companyname (Lastname, Firstname)
                ' strFileAs = .CompanyAndFullName
               .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

Test for Names and Company

If you have a mix of contacts for people, with a value in the Fullname field, and companies, where the Fullname field is blank, you can replace the With objContact... End with code block with the snippet below.

This code checks for a value in the fullname field and if it's blank, it looks for a company name. If a value is in the company name field, it's used in the FileAs field.

            With objContact
             ' Test for blank name field
             If objContact.FullName = "" Then
                If objContact.CompanyName <> "" Then
                   .FileAs = .CompanyName
                End If
                .FileAs = .FullName
             End If      
            End With

Change Mailing address

If you need to switch the mailing address to the business address field (or from business to home address) you can check for a value in the business address field, and if not blank, copy it to the .MailingAddress field.

Use .HomeAddress if you want to make the home address the mailing address.

As with the code above, replace the With objContact... End with code block in the macro with the snippet below.

            With objContact
               If .BusinessAddress <> "" Then
                 .MailingAddress = .BusinessAddress
               End If
            End With

Customize the code

I call this code sample my "super-duper bulk contact changer macro" because it's so easy to change it to work on other Contact fields. Simply replace section in the original macro that changes the FileAs field with other fields.

For example, changing it to .Body = "" will erase text from the body, solving a problem Nox had syncing contacts to a smart phone. If the phone can handle some text, you could keep some of the text, replacing 1024 with the number of characters you want to keep.

      ' keep some text 
               .Body = Left(.Body, 1024)

 If obj.Class = olContact Then
        Set objContact = obj

            With objContact

      ' erase the entire body
               .Body = ""

            End With
End If

Common Errors

Colors when the code is correct
After pasting the code into the VB editor, the colors should be similar to the colors in this screenshot (and as seen in the code sample above).

Any text shown in Red has an error in it.

Blue, Black, and Green are "good", with the Blue color indicating VBA commands (If, Then, End etc), Black is your variables, and Green is used for comments. The second line in one of the 5 sets of Green lines needs to have Black text. You do this by removing the apostrophe (') from in front of the line. If more than one of those 5 lines is black, add an apostrophe to front of the format line you don't want to use. (In my screenshot, the second set is the format I want to use.)

Change only the 'subject' field used by the Address book

Note: this was written for an older versions of Outlook and is not needed with new versions.

Use the Outlook File As Order custom form to change just the display in the Address book, from Last name first, to First name first or use the File As entry.


  • This method will not change the actual sort order in the Contacts folder or format used on the File As field.
  • Will return an error if there are distribution lists in the Contacts folder.
  • This has the same options as you'll find in Tools, E-mail Accounts, View or change existing Address books, Outlook Address book properties, but also adds Last name first option and full File As format, including the Company name.
  • Works on any contact folder - select the folder before clicking Run in the VB Editor or pressing F5. Leave the editor open and select another folder to use it on additional folders.

Tools in the Spotlight


Tagwolf helps people save time while filing their email messages to folders in Microsoft Outlook. Tagwolf speeds up this task by intelligently suggesting the best folder for each email message. Instead of having to drag and drop emails to a large folder structure, users can simply accept this suggestion and file a message with one click. Works as an add-in for Microsoft Outlook 2007, 2010 and 2013.


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.

The original code works on the default Contacts folder and many users asked for a version that worked on the selected folder. We edited the code to change the selected contacts in any folder. Note that you do need to select the contacts, not just the folder.

Code Sample 2: Change FileAs on Selected Contacts

This code sample is an edited version of the previous code and works on the selected folder. I tested it in Outlook 2010 but it should work in all versions that the original code works with. This is the same code that is in the text file on page 1.

To use, you need to select the contacts. Use Select All (Ctrl+A) to apply it to all contacts in a folder or use Ctrl+click to select some contacts.

Public Sub ChangeFileAsSelectedContacts()
    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
            ' Uncomment the  strFileAs line for the desired format

                'Lastname, Firstname (Company) format
                ' strFileAs = .FullNameAndCompany
                'Firstname Lastname format
                 strFileAs = .FullName
                'Lastname, Firstname format
               '  strFileAs = .LastNameAndFirstName
                'Company name only
                ' strFileAs = .CompanyName
                'Companyname (Lastname, Firstname)
                ' strFileAs = .CompanyAndFullName
               .FileAs = strFileAs

            End With
        End If


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


  1. Jan Kuyl says

    This is the script I havge been looking for.

    I ran the VBA script in Outlook 2007 to change the FileAs property of all my contacts to "Firstname Lastname", with partial success. All contacts with a title (Mr. or Mrs.) kept their old display property, meaning "Smith, John" became "John Smith", but "Mr. Ferguson Alex" did not change.

    Is there an updated version/fix for this script available?

    • Diane Poremsky says

      I'll have to test it - I've never seen that happen, but I don't use a lot of titles either. It should not affect it as the title isn't used in the file as field.

  2. Robert says

    Works with Outlook 2010 SP1. Haven't tested with anything other than .FullName, but it served it's purpose. Thanks for the script!

  3. Yakira says

    I'm not used to doing any of this stuff but input the script as explained. How do I actually run it? What do I do after pasting it into VBA?

    • Diane Poremsky says

      Select the contacts folder that needs changed and press the Run button (or F5) in the VB Editor.

  4. Jeff says

    Need some help. I am getting an "Compile error: Expected End Sub" error. I do not have any distribution lists in my contact folder.

    I pasted the code into VBA under ThisOutlookSession.

    Went back to Outlook and have selected the contact folder and also tried to select all contacts in the folder.

    I keep getting this error any suggestions? I feel that maybe I am not selecting the contact list correctly.

    After I clear the error, the ver first line "Public Sub ChangeFileAs () is highlighted in yellow with a yellow arrow to the left of it.

    • Diane Poremsky says

      Is the last line in the VB Editor "End Sub" ? Make sure you have it (and all the code in between). You should be able to click in the code box above and press Ctrl+A, C to select all and copy it.

      The font size is larger in Firefox so the code extends beyond the codebox but Ctrl+A will select all, whether it is visible or not. (Font size is now fixed - the entire code sample should display in the box, ending in End Sub.)

  5. J Lewis says

    I have more than one contacts folder (suppliers, as well as contacts, which is customers and personal contacts). If I select the one (suppliers) I want to update, it does not update it. Any ideas? Can I change the "set" references in the script to "suppliers" where "contacts" currently appears?

  6. J Lewis says

    it may be something I did, but i got a syntax error. I copied into the editor after alt-f11.

    i copied from "public...


    ...end sub"

    • Diane Poremsky says

      It's the ' that mark comments- they are probably red in the VB Editor - they should be green. For whatever reason the ' was changed. (One can learn to hate this software... and I mean wordpress, not outlook. Sometimesi think wordpress has as many quirks and annoyances as outlook. <g>)

      Try the code here: - it should be perfect.

  7. J Lewis says

    Oddly enough, (no error after pasting the text), but instead of changing "file as" to [company (last, first)] it erases the "file as" field. Not on all the contacts, but the contact I have selected in outlook, in the background. If nothing is selected, nothing is changed.

    Thanks for the help by the way, even though I haven't been able to knock this out yet.

    I'd do this by hand, but there are 920 vendors in my outlook. Thanks again for any help.

    • Diane Poremsky says

      Did you remove the apostrophe from one of the formats? I'll post a screenshot above in a few minutes so you can see what you should be seeing.

    • Diane Poremsky says

      I updated the instructions and added a screenshot - remove an ' from the format you want to use then run it.

  8. J Lewis says

    I deleted the '. Sorry I didn't know what that meant. Newbie to this stuff.

    FYI, it only worked when a record was selected. Therefore, I had to select the records within my contacts folder to make it work.

    OL 2007 (12.0.6562.5003) on Win 7x32

    Thanks for the help!

    • Diane Poremsky says

      Glad we got that straightened out - and thanks for pointing out areas where i needed to improve the instructions.

  9. Rae Ann says

    Can you tell me how to display the Notes section on the address book? One of my staff really wants to see her notes when viewing the address book. Is this possible in Office 2010?

    • Diane Poremsky says

      That is not possible in any version of Outlook. She can use the Contacts folder to view the notes then right click on the contact and choose Create > New message to.

  10. Justin says

    I am getting a "Compile error: Expected End Sub" error as well. I downloaded the text file and pasted from that, and it isn't working. When I get that error the first line is highlighted in yellow and "objContact =" from

    If obj.Class = olContact Then

    Set objContact = obj

    is highlighted in blue.


  11. Ray says

    Worked brilliantly! Thanks!

    Is there any way to change the File As to First Name Last Name (Company)? Other than manually, that is.

  12. Ramon says

    I don't use the default Outlook Contacts Folders, but iCloud. I guess the following line needs to be changed:
    Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
    question is, how do I identify the name of the icloud contacts Folder?

  13. Nicu says

    Thank you, easy to set up. Just after I copied the script there were two errors, but copying it from the link you provided in comments it worked.

  14. Taqi says

    Thanks for this Diane! So I installed the VBA but when running, the "play" icon is not highlighted it seemingly does nothing. When it is running (I think) and when I click on the shortcut in the outlook after highlighting the contact, it erases the whole "File As" field.

    My question is: How do I use this macro?

    • Diane Poremsky says

      Did you remove the comment from the line you wanted to use? If not, it sets the fileas to nothing.

  15. PeterB says

    I feel that I'm so near to what I need, but can't quite finish off - can you assist?

    I'm following the "Change only the 'subject' field used by the Address book" instructions above, but fail at the "Usage" paragraph in the ReadMe file - I don't see the 3 buttons! I simple want the sort order in the address book to be the same as the values in the FileAs Field, ie Subject Field = FileAs.

    I'm using Outlook 2010 on a standalone Windows 7 PC (ie no exchange server).

    The form reads as if this is a one off, bulk conversation - is there script to set this as the permanent option for all new/amended contacts?

    Thanx, Pete

  16. Markos says

    Hi all,

    really useful vba macro indeed.

    I have an additional problem and was wondering if anyone has solved it before:

    At the office we have been inputting the First and Last Name in the wrong order - meaning that Outlook was set up to expect First Last in the Fullname field while we were putting Last First. Now more thatn 1000 contacts have the wrong order in the Fullname field. Is there a VBA for a bulk change (order reverse)?



  17. Armin says

    thank you! the change File As for default folder worked perfect.
    I do have other contact folders that i was hoping to change the file as, so i selected the contact folder, went to VBA by pressing Alt+F11, paste the selected folder script but when trying to run i get an error:

    it highlights "folder As Outlook.folder" and pop ups the following error:
    Compile Error:
    User-Defined type not found

    i am using outlook 2003.

    can you help please?

    • Diane Poremsky says

      I can't repro the error but I see I had a typo on the page (now fixed) - the revised code is for *selected contacts*, not the selected folder. Do you get the error if you select contacts first?
      Are any lines in red font?

  18. Mike says

    I could not get this to work. Let me give you how things are setup in my system.
    I am running Win 7 and Outlook 2010.
    I am connected to an exchange server so I do not have a pst file, instead on pc is an ost file.
    I have 24 contact folders all with unique names under My Contacts
    When I run the script I get the following error
    Compile error:
    Syntax error
    The script stops at Firstname Lastname format
    I have removed the ' from both the Firstname Lastname format line and the strFileAs - .FullName
    Can you advise me on what to do next?

  19. Paddy says

    Thankyou Diane this is brilliant. I have used both VBA for Display as ans File as. Very nice and convenient. Pitty it choices aren't available in contacts as a default.

  20. Paul Nocero says

    I added the following three lines after the .FileAs= line to update the way e-mail addresses are displayed, to make them consistent with the contact name:

    ' Set "Display As" name in Contact folder

    If .Email1Address "" Then .Email1DisplayName = .FileAs & " (" & .Email1Address & ")" Else .Email1DisplayName = ""
    If .Email2Address "" Then .Email2DisplayName = .FileAs & " (" & .Email2Address & ")" Else .Email2DisplayName = ""
    If .Email3Address "" Then .Email3DisplayName = .FileAs & " (" & .Email3Address & ")" Else .Email3DisplayName = ""

  21. Paul D says

    I can't get this to work. I am on an Exchange server and the script prompts me for my Outlook credentials. I type in my logon password but it won't accept this and re-prompts. Is there a separate Outlook "credential"? I use the logon to access Outlook via a browser, although I almost never do this. Any help would be greatly appreciated. Thanks!

  22. Carl Bell says

    I want to change the "Display as" from an Email address to a First name space Last Name.
    Can it be done?

  23. nicolo says

    hello everyone! i tried copy and pasting both vba codes. but i always get an error stating "macros in this project are disabled outlook 2010" i have no idea what to do next.
    i enabled the macro lowered security to medium then to low.
    i am using outlook 2010.
    can someone please help me?

    • Diane Poremsky says

      You need macro security on low. If the macro won't run and macro security set to low, try restarting Outlook.

  24. nicolo says

    Hello Diane,
    just a quick question for you.
    I am trying to adapt your vba code to fix the file as of my outlook contacts.
    When i receive them from the icloud i get them with the file as field inverted (last, first)
    I followed your guide step by step and was able to fix that using the script on page 2 but i cannot seem to make the one on page 1 work.
    I'm guessing that the script on page 1 is for the default outlook folder and not for the icloud folder.
    Is there a way that i can change the name of the folder so that the icloud contact folder will be tageted?

    • Diane Poremsky says

      Correct, page 1 is for the default folder. Page 2 is for the select contacts so it doesn't matter what folder they are in.

      I have instructions for using different folders at Get Outlook folder paths - because its in the icloud, you need to use GetFolderPath function then replace Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts) with Set objContactsFolder = GetFolderPath("icloud path") - I'm not sure offhand what you'd use for the icloud path - i don't have it installed on this computer. Probably iCloudfolder-name, but I haven't tested it. The macro might not work since icloud doesn't use a pst file. I'll look into it tomorrow afternoon.

    • Diane Poremsky says

      BTW, you can use the code on page two and select all contacts in the icloud folder.

  25. Tom Petrie says

    Hi Diane,

    I'm fairly elliterate. I've just lost the IT guy who'd hold my hand and now I'm trying to fly solo. What I'd like to do is to re-organize all 3682 contacts in my 2010 Outlook so that they are filed by company name. I'm trying to follow your instructions step by step, but I'm stymied on Step One: Alt+F11 opens Send/Receive Groups, not the VBA Editor you reference. What to do?

    • Diane Poremsky says

      something is not right - Send / Receive groups is Ctrl+Alt+S. Go to File, Options, Customize Ribbon and enable the Developer ribbon. Return to outlook and open the VBA editor from the Developer ribbon - button is on the left.

  26. Tim Ponting says

    Such a useful piece of code, many thanks. We use Title, Middle Name and Suffix fields for our own data purposes, not as Outlook intended, and by modifying this code a little it has allowed us to generate clean File As and Email Display Name fields automatically.

  27. Gary says

    Thank you sooo much!!! Been battling with this as I used excel to clean up all the contacts and then imported them back only to find the "file as" a mess. It messed with the way contacts were displaying in my phone too
    Thanks again!

  28. Harry says

    Don't come round here...I'll have to give youd a big tongue kiss. Thankfully I was smart enough to do a search before changng 750 contacts one at a time. Kudos to you!

  29. mayur says

    Hi, Diane

    I also looking for same thing, but my concern is that, i want to detect which default format user has set for File As field.

    Once it conforms then only again ask him to change it or not..!!

    can please help me on this..!

    • Diane Poremsky says

      I'll test some code - basically, you need to get the format used for .FileAs and display it. It might be harder to do than it sounds, but I'll take a look at it.

  30. David Tabor says

    The code ran fine and changed all to the format I wanted (Lastname, Firstname)but seconds after changing it reverted back to Fullname. Not sure what I'm doing wrong.

    • Diane Poremsky says

      Are you doing this on a Hotmail connector account? I know it does this - the server expects a specific format.

  31. Rob says

    I ran this for a client. it worked great on 3118 contacts, Thank you!
    I was wondering if it is at all possible that this could have created duplicate contacts? client is complaining of multiple contacts. not all but quite a few.

    Please let me know

    • Diane Poremsky says

      What type of email account? No, it won't create duplicates - it just changes the field, it doesn't copy the contact. However, it's possible that as the result of the change, a poor syncing experience with a smartphone resulted in duplicates. It's also possible that by putting all contacts in one format, they sort better so you can see you have duplicates. This is more likely if there are a few dupes.

  32. Julia says

    As I have never done/heard of VBA before, it took me a while to figure out that I have Microsoft Outlook open at the same time as the VBA. I had to guess to click on all the directory levels to get to ThisOutlookSession, then copied and pasted the code into VBA. I selected each of my address lists, then went back into VBA/This session, and pressed F5. Another box came up with Run, so I chose Run. I then closed out Outlook, but my Display As still shows as email addresses, not the person's name. Have I missed something? I am almost completely at a loss. Thanks for any further help you can give me.

  33. steve s. says

    i use Outlook 2010 and am having trouble finding the "this outlook session" you reference. when i hit ALt + f11 i see the VBA but what do i click on to open a window into which i can paste your code? i see reference to left pane, but can't find the 'This Outlook Session' within. thanks.

  34. steve s. says

    thanks for quick reply. i wonder if in clicking on different things to try and figure this out, i now messed up something. now saying macros are disabled?? thanks.

    • Diane Poremsky says

      Did you enabled macros earlier? In Outlook 2010, go to File, Options, Trust center and set macro security to low to run the macro.

  35. jaydr says

    Not a vba expert and I'm having the same problem as the first commentor, with the Titles (Mr, Mrs etc) winding up in the file as field. Is there a way to alter the code so that it is set to FirstName LastName instead of FullName (which I guess includes the titles)?

    Thanks for your help. This otherwise is terrific for me.

    • Diane Poremsky says

      I'm not seeing titles included, but suffixes (Jr, Sr) are part of the full name field.

      Assuming last name, first name ( strFileAs = .LastNameAndFirstName) is not desired format, try

      strFileAs = .Firstname & " " & .lastname

      Note that when you only have a first name, the space separating the name fields is added anyway. And editing a contact that has a suffix may change it to full name field since its not a valid format.

  36. Julia says

    I'm still not getting Display Name as Smith, J. It shows the email address on most of them (presumably the ones not imported from Outlook Express). The Name column shows correctly. Any ideas, please and thanks? (I don't know how to use all this Visual Basic stuff and what I did try from above obviously didn't work.) I hope I don't have to go and change each one individually--there must be about 500 names.

  37. Howard Bachtel says

    I would like to have the Address Book display the name and e-mail only (omit the column "Display Name" as it is redundant. This area looks like an option but I don't see this specifically. I am not proficient at VBA but have used it some. Can you give me any advice?

    Thank you in advance.

  38. Jawad says

    All my file as area is now blank after using this macro. Partially worked (removed all file as data) but didnt add the new file as data.

    • Diane Poremsky says

      Which file as format did you choose? It shouldn't remove any data - only set one of the file as types. If you choose Company and people don't have a company, it may be blank. You'd need to use an If.. then statement to check for a company name and fall back to full name if one did not exist.

    • Diane Poremsky says

      Use this if you want the companyname field and not everyone has a companyname - the companyname/fullname combinations won't need this, only the company name only option.

      With objContact
      If .CompanyName <> "" Then
      strFileAs = .CompanyName
      strFileAs = .FullName

      End If
      .FileAs = strFileAs
      End With
      End If

  39. Val says

    It worked but i forgot to Uncomment the strFileAs line that uses the format i wanted , and your code was set to

    'Lastname, Firstname format
    ' strFileAs = .LastNameAndFirstName

    I needed:

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

    Now all the names display as last name, first name format .
    When i past the code again and run , it gives me an error message ::
    The macros in this project are disabled. Please refer to the online help or doscumentation of the host application to determine how to enable macros.

    Any ideas ?
    Thanks in advance,


  40. Kendra Von Achen says

    genius! It worked! I recently synced my contacts between 3 different programs, including Outlook and it messed up most of my File As formats. I ran your code across all of my contacts and it fixed it! Thank you so much for sharing this!!!

  41. Wrong Passport says

    Thank you! I had been annoyed with this problem for years; I finally decided to do something about it and there was your solution

  42. MTran says

    Thanks very much. Worked perfectly and has saved me the mundane approach of having to change individual contacts.

  43. wallrats says

    Great Script works flawlessly on the "default" contact list.. Is it possible to modify the script to run against a non-default Contact List. I have a few contact list for different groups of people. I have the following list titled: Contacts, Manufacturing USA, Manufacturing EUR, Sales USA, Sales EUR. Any help would be greatly appreciated..

  44. Breanne Miller says

    The Macro worked; however, the company is not listed between parenthesis. How can i fix this? I'd like it to appear as: Last, First (Company)

    • Diane Poremsky says

      Did you use the fullnameandcompany format? That should be the format with parents around the company name

  45. STGdb says

    Nice script Diane, thank you very much. I know that the thread is old but it still works.

    Also, for anyone who is interested, your not stuck with using just the standard five selections that Microsoft provides in Outlook. Just place a comment character in front of the line:

    strFileAs = .FullName

    ...and below the line you just added a comment character to, add:

    'Configure FileAs to be Company Name (Full contact name)
    strFileAs = .CompanyName & " (" & .FullName & ")"

    Or you can the same results as the above line with something like:

    'Configure FileAs to be Company Name (Full contact name)
    strFileAs = .CompanyName & " (" & .Title & " " & .FirstName & " " & _
    .MiddleName & " " & .LastName & " " & .Suffix & ")"

    The benefit about the latter of the two examples above is that you can remove just the contact's Title or their Suffix or you can change the character that encloses the contact's name.

    • Diane Poremsky says

      If you use custom fields, i recommend using an if statement, so you don't have weird things like "Acme ()" or " (John Smith)"
      if .CompanyName = "" then
      strFileAs = .fullname
      strFileAs = .CompanyName & " (" & .FullName & ")"
      end if

      However, you could just use strFileAs = .CompanyAndFullName. If you use want to change the name order without changing it in the contact (eg from last, first to first last) you need to use a custom format.

  46. Dave O says

    This worked perfectly in Outlook 2013. Thank you so much for taking the time to post these detailed instructions.

  47. EIKAinc says

    Hi Diane!

    I am not VB expert, but I need a little bit different script. I need to re-arrange Full Name column, not File As column. Now when I import data to Outlook 2013 from iCloud, names appear as FirstName LastName, but I need LastName FirstName (and no comma between). And I do not use FileAs column at all (it contains data, but it's hidden).

    Could you please change script to satisfy my requirement?


  48. simonjhudson says

    Brilliant - this issue was beginning to really hurt me as CRM keeps updating stuff without regard to my preferred order.
    Thanks !!

  49. Dale says

    To change the mailing address to .BusinessAddress I used:
    SelectedMailingAddress = 2

    .MailingAddress = .BusinessAddress simply copied the address information from .BusinessAddress to .HomeAddress (which was the defaulted .MailingAddress).

  50. john says

    Hi Diane I have a strange behaviour when importing a bulk contacts csv file, while having selected the First, Last (both in address book and Options/People) I get a contacts' appearance in the first column (File As) which is First, Last, Company (!). I tried running your script on the selected contacts folder with the .Firstname parameter selected but all I got is the same result. Any ideas are welcome because this is already driving me crazy. =)

    • john says

      It's an Exchange 2013 account. What puzzles me is that the above presentation (First, Last, Company) isn't defined anywhere in the Outlook options. Shouldn't the 'File as' behavior for bulk importing contacts be the one set in the Outlook options, so 'First, Last Name' as I have already chosen? Also when I edit the Outlook properties I get the option of setting it (manually) AS it should be. Thanks.

    • Diane Poremsky says

      Just noticed this in your other comment:
      I tried running your script on the selected contacts folder with the .Firstname parameter selected but all I got is the same result.

      That means the name and company are all in the first name line. Click the Full name button to check.

  51. john says

    Hello Diane and thanks for taking the time to reply. I 'd like to add some more details on the matter. The contacts are inside a public folder so they are distributed to all people of the company I am working at this moment. When I make the initial import to a local Outlook Contacts folder the information is displayed normally as should (in the address book) but... when this folder is copied to the public folder's mailbox on Exchange and is being retrieved through there, then the address book 'File As' is being changed to that strange format I described above. I have done the import many times with all possible combinations and all times I experienced the same behavior...correct 'File As' locally, altered when retrieved from the Public folder. Regards.

  52. john says

    Yes it is. Actually the First Name field holds the company name, and the Last Name field holds the fullname. So based on the First, Last "File As" configuration I should get a "Company (First Name), Fullname (Last Name)" presentation which I don't. Actually I don't understand how the company is added again at the end of the 'sentence'. Also inside the contact I get the option to correct the "File As' and have it displayed as it should. Thanks again for helping.

  53. Richard Smith says

    When I imported the outlook data file, some of my contacts' home addresses ended up showing as business addresses. Any way to convert those addresses from the business address column to the home address column?

Leave a Reply

Please post long or more complicated questions at OutlookForums by

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