Question : Outlook 2003 Contact List >> File As: Need to mass change format.

I have a 'cell phone' contact list with 100+ contacts (name and numbers only) that is used to program a cell phone (nothing special about this list).

Originally, the Default File As (Tools>>Options>>Preferences>>Contact Options) was set to
Last, First.  Consequently, all contacts in this list (and all lists) are 'filed' as such.

I now need to have all contacts in this list to be filed as First Last.

I've been through every menu option, Actions and settings, etc., and I'm not seeing an option to do a 'mass' change for this.  It seems the only approach is to do each contact manually, which is not acceptable.

How can I do this for all contacts at the same time?

If there is not a 'menu' operation in the UI, is there a vba code snippet that will do this?

thx..mx

Answer : Outlook 2003 Contact List >> File As: Need to mass change format.

To hit Contacts and its subfolders...




Sub FixFileAs()
   
    Dim ns As NameSpace
    Dim mf As MAPIFolder
   
    Set ns = Application.GetNamespace("MAPI")
    Set mf = ns.GetDefaultFolder(olFolderContacts)
   
    ActuallyDoIt mf

    For Each mf In ns.GetDefaultFolder(olFolderContacts).Folders
        ActuallyDoIt mf
    Next

    Set mf = Nothing
    Set ns = Nothing
   
    MsgBox "Done"
   
End Sub

Private Sub ActuallyDoIt(ByRef mf As MAPIFolder)

    Dim ctact As ContactItem
    Dim it As Object

    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

End Sub
Random Solutions  
 
programming4us programming4us