GregLedet.net Adventures in networking, security, and other things

26Mar/107

Changing the “file as” format for contacts in Outlook 2007

Today I was working on changing my email server for this domain from being self hosted to being hosted with Google.  In the process of this, I was trying to do too much at once and ended up learning how to do a few things.  First off, you can get push notifications to your Windows Mobile phone from Google.  Go check out Google Sync for your Phone.  Don't worry, I'll be here when you get back...

Now that you're doing that, check this out.  I like my contacts to be listed as "FirstName LastName" or what Microsoft calls the "FullName" file as format.  Google likes to make it's default "LastName, FirstName" and that's where I ran into this problem.  I synced my phone with my computer and in the process got all my contacts and calendar on the phone up to date.  I setup Google Mobile Sync on my phone, which acts exactly like an Exchange Server, and told it to sync Mail, Contacts and Calendar (Tasks doesn't work). I then synced my phone to my new Google account.

Everything looked all hunky-dory, until the next time my phone synced with Google.  While my contacts were on the Google server, it changed my "file as" format!!!  My contacts went in like "Greg Ledet" and came back out "Ledet, Greg".  Needless to say, this pissed me off and I was not going to sleep until I could find a fix.  As you can see, it's 4:24 in the morning right now, so I haven't slept!

I found this post and this post on Google's support site and neither one of those actually gives a proper answer.  It doesn't look like Google plans on fixing this anytime soon, so here's a work around to fix the the format and the way I'm making sure my stuff is up to date.

As it sits, the phone and computer are both using "Lastname, Firstname" and I want those two back to "Firstname Lastname" (FullName).  To do that, open up Outlook and go to your Contacts.  We're going to write some quick VBA code and make a macro to take care of this problem for us.  Follow the steps!

  1. Press Alt+F11 to open the VBA editor. You may have to enable macros (Tools ->Trust Center->Macro Security->Warnings for all macros->OK).
  2. On the left side, you'll see "Project 1" in the top box. Expand the plus next to "Microsoft Office Outlook Objects" and clink on "ThisOutlookSession".
  3. Paste the following code in the "ThisOutlookSession" code box.
  4. 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 
    
     '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
    
     .Save
     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
  5. Uncomment the strFileAs line that uses the format you desire before running it. In my case, I want to use the Full Name (FirstName LastName), so I would remove the red apostrophe ' that is in front of the blue strFileAs = .FullName. If you want to use a different format, just remove the apostrophe in front of the format you want to use.
  6. Save the project, click "Run" on the menu bar, and click "Run Sub/UserForm" (or you can just hit F5)
  7. That's it!

Your contacts are now in the "Greg Ledet" order on your computer, but they are still "Ledet, Greg" on your phone and Google.  This is what I've done to things fixed.

  1. On your Windows Mobile phone, open up ActiveSync.
  2. Go to "Menu" then "Options" while in ActiveSync
  3. Under "Microsoft Exchange" make sure that "Contacts" is unchecked.
  4. Under your computer name (in my case, "Greg Laptop"), make sure that "Contacts" is checked.
  5. Connect the phone to the computer via sync cable, bluetooth, dock, etc. and Sync!

This should get the contacts on both your computer and your phone in the "FirstName LastName" format.  If it's not, you may have to delete the contacts off your phone before you sync with the computer.

As far as Google's contacts go, there is no way I can find to make the contacts there use the proper formatting.  Google's contacts will always use the "LastName, FirstName" format, which is why in the last few steps you removed contacts from syncing from Google (Google=Microsoft Exchange in this case).  They way I'm getting my contacts to Google is to just reverse where contacts are synced.  I sync with "Microsoft Exchange" and not with "Greg Laptop".  Once I sync them up, I put it back to only sync from the computer.  It would be a lot easier if Google would just fix this crap already, but it's not getting done.

If you can't follow these instructions, I suggest you do some more Google searches and brush up on your reading comprehension. I couldn't make this any clearer from the original.  And the best part about this looooong how-to?  It's all about Microsoft and I had to finish it in Linux because Windows kept crashing.

   
7 visitors online now
3 guests, 4 bots, 0 members
Max visitors today: 17 at 02:25 am UTC
This month: 94 at 05-03-2013 04:12 pm UTC
This year: 94 at 05-03-2013 04:12 pm UTC
All time: 106 at 08-27-2010 05:48 am UTC

Switch to our mobile site