File As

A

April

I want to change all my contact so they are setup with the new format of
"Firstname, Surname" in the "File As" field.

Some of my old contacts have a blank "File As" field and others the format
of "Surname, first name". Is there a quick way to bring these all in line
with the above format?

Is it best to leave the contact with a blank "File As" as they are with no
text?

Thank you
 
M

Michal [Outlook MVP]

Hi April,

IMO the best way (if not the only) is a simple macro. You will find it below.
It is for Outlook 2007. If you're using earlier version, replace the first line with:
Dim oFolder As MAPIFolder


Sub FileAs()

Dim oFolder As Folder
Set oFolder = Session.PickFolder

If oFolder Is Nothing Then Exit Sub

For Each Item In oFolder.Items
Dim oContact As ContactItem
Set oContact = Item
If Not oContact Is Nothing Then
If oContact.FirstName = "" Then
oContact.FileAs = oContact.LastName
ElseIf oContact.LastName = "" Then
oContact.FileAs = oContact.FirstName
ElseIf oContact.LastName <> "" Then
oContact.FileAs = oContact.FirstName & ", " & oContact.LastName
End If
oContact.Save
Set oContact = Nothing
End If

Next

End Sub


--
Best regards,
Michal [Microsoft Outlook MVP]

http://www.codetwo.com
Share Outlook on the net without Exchange!
 
A

April

Thanks, but the problem is that I do not understand what the code is doing?
and also I have not used the macro facility before? Seems like alot of work
for a beginner.

ie. what does Dim oFolder As Folder mean? and what does Set oFolder =
Session.PickFolder?


Michal said:
Hi April,

IMO the best way (if not the only) is a simple macro. You will find it
below.
It is for Outlook 2007. If you're using earlier version, replace the first
line with:
Dim oFolder As MAPIFolder


Sub FileAs()

Dim oFolder As Folder
Set oFolder = Session.PickFolder

If oFolder Is Nothing Then Exit Sub

For Each Item In oFolder.Items
Dim oContact As ContactItem
Set oContact = Item
If Not oContact Is Nothing Then
If oContact.FirstName = "" Then
oContact.FileAs = oContact.LastName
ElseIf oContact.LastName = "" Then
oContact.FileAs = oContact.FirstName
ElseIf oContact.LastName <> "" Then
oContact.FileAs = oContact.FirstName & ", " &
oContact.LastName
End If
oContact.Save
Set oContact = Nothing
End If

Next

End Sub


--
Best regards,
Michal [Microsoft Outlook MVP]

http://www.codetwo.com
Share Outlook on the net without Exchange!


I want to change all my contact so they are setup with the new format of
"Firstname, Surname" in the "File As" field.

Some of my old contacts have a blank "File As" field and others the
format of "Surname, first name". Is there a quick way to bring these all
in line with the above format?

Is it best to leave the contact with a blank "File As" as they are with
no text?

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top