How to change the firstname, surname display order of contacts imported from Excel

I have successfully imported a list of 423 contacts from Excel into Outlook contacts.  The default view for imported contacts is surname, firstname.  I want to be able to display them as firstname, surname.  It is straight forward changing this setting for NEW contacts in tools - options - contact options default "File as" order but this only applies to NEW contacts, not the imported ones.  I've tried adjusting the field mappings before importing but the result was the same.  I don't fancy having to go into each one of the 423 contacts and change it manually so a global fix would be appreciated.
Neos-ITAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Patrick MatthewsCommented:
This works in Outlook 2003:

1) Select the Contacts folder

2) Select View|Arrange By|Current View|Customize Current View from the menu

3) In the Customize View dialog box, click on the Sort button, and choose your sorting options
Neos-ITAuthor Commented:
Thanks.  Yes, I tried that earlier (and just then) but it doesn't work.  From the View|Arrange By|Current View|Customize Current View|"Sort By" I've tried the following:

a) firstname ascending, then by (none)
b) firstname ascending, then by lastname ascending.

Customising the current view doesn't seem to be overiding the "File as:" option from within the actual contact object itself.
Patrick MatthewsCommented:
Neos-IT,

Sorry, I misunderstood the question.  The code snippet below should change the FileAs property
on all contacts in your regular Contacts folder to LastName, FirstName.

It needs to be run from Outlook, and pasted into a regular VBA module.

Regards,

Patrick
Sub FixFileAs()
    
    Dim ns As NameSpace
    Dim mf As MAPIFolder
    Dim ctact As ContactItem
    Dim it As Object
    
    Set ns = Application.GetNamespace("MAPI")
    Set mf = ns.GetDefaultFolder(olFolderContacts)
    
    For Each it In mf.Items
        If it.Class = olContact Then
            Set ctact = it
            With ctact
                .FileAs = .LastName & ", " & .FirstName
                .Save
            End With
        End If
    Next
    
    Set it = Nothing
    Set ctact = Nothing
    Set mf = Nothing
    Set ns = Nothing
    
    MsgBox "Done"
    
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Neos-ITAuthor Commented:
ok, thx.  I thought it may need a script but as I have no experience of scripting I hit this wall.  Apologies for the next basic question; how do I create and run the script.  Do I paste it into notepad and save it as a vbs file or will I need an app like visual studio?
Neos-ITAuthor Commented:
Many thanks Patrick, I called my friend who talked me through running a VB module within Outlook.  It worked very well.  The only slight issue (this is not a moan) was that it added a comma to 7 users who were listed and did not have a Lastname but I'll change them by hand - but hey I'm not complaining ;-)  Many thanks once again, it really helped me out.  kind regards, Greg.
Patrick MatthewsCommented:
Neos-IT,

1) From Outlook, hit Alt+F11 to get to the VB Editor

2) Insert a new module, and paste the code there

3) Hit F5 to execute the code

Regards,

Patrick
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.