Joe,
You should be able to modify the code I post here to suit your need:
http://www.experts-exchang
Patrick
Main Topics
Browse All TopicsI 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>>Preferenc
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
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Joe,
You should be able to modify the code I post here to suit your need:
http://www.experts-exchang
Patrick
Hi Patrick ...
Soooo ... all I would need to change is this:
.FileAs = .LastName & ", " & .FirstName
to
.FileAs = .FirstName & " " & .LastName
?
Also, do I need to specify the name of the specific contact list? I guess actually, change all of the (about 4) is fine.
Is the code otherwise bullet proof ... as I'm not familiar with interfacing with Outlook ?
thx.mx
Patrick ... ok, I see that it's just iterating through the 'contacts' folder (below the CellPhone folder). So, what is the code to loop through all those folders? I tried some different things, but I'm just not familiar Outlook object model ... and couldn't really get it to pick up the other two folders shown.
And ... you can't Rename the Contacts folder either. I was going to rename Contacts, then rename CellPhone to Contacts and fool it like that.
thx.mx
ok ... this does it:
Function FixFileAs()
Dim fld As MAPIFolder ' need MAPIFolder
Dim ctact As ContactItem
Dim it As Object
Set fld = Application.GetNamespace("
For Each it In fld.Items
If it.Class = olContact Then
Set ctact = it
With ctact
'Debug.Print ctact
.FileAs = .FirstName & " " & .LastName
.Save
End With
End If
Next
Set it = Nothing
Set ctact = Nothing
Set fld = Nothing
MsgBox "Done"
End Function
mx
Something like this:
Sub FixFileAs()
Dim ns As NameSpace
Dim mf As MAPIFolder
Dim ctact As ContactItem
Dim it As Object
Set ns = Application.GetNamespace("
Set mf = ns.GetDefaultFolder(olFold
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
To hit Contacts and its subfolders...
Sub FixFileAs()
Dim ns As NameSpace
Dim mf As MAPIFolder
Set ns = Application.GetNamespace("
Set mf = ns.GetDefaultFolder(olFold
ActuallyDoIt mf
For Each mf In ns.GetDefaultFolder(olFold
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
No additional sub folders. And I will eliminate the sce folder also, leaving just two. In fact, I would only have one, but ... that must makes it more complicated to do the cell phone gig ... since the 'master' list (ie ... Contacts only) would have a lot more names that I don't really need or want in the cell phone.
mx
Business Accounts
Answer for Membership
by: leakim971Posted on 2009-10-31 at 12:39:50ID: 25711213
Hello DatabaseMX,
You may export your contact to a CSV file to work on it with Excel (invert the column lastname and firstname)
Delete your contacts in Outlook and do a sync with your cell phone.
Regards.