I am using this script to update the Display as field for my Outlook Contacts. (I got the script from: http://www.slipstick.com/outlook/contacts/bulk-change-outlook-contacts-email-display-name-format/
It works great for my contacts in my local contact folder. I want to run this script against contacts in a Public Folder Contact List. I'm not sure how to do it. Can someone help?
Public Sub ChangeEmailDisplayName()
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.Appl
Set objNS = objOL.GetNamespace("MAPI")
Set objContactsFolder = objNS.GetDefaultFolder(olF
Set objItems = objContactsFolder.Items
For Each obj In objItems
'Test for contact and not distribution list
If obj.Class = olContact Then
Set objContact = obj
If .Email1Address <>"" Then
' Uncomment the strFileAs line for the desired format
' Add the email address to any string using
' the following code:
' & " (" & .Email1Address & ")"
'Firstname Lastname (email address) format
' strFileAs = .FullName & " (" & .Email1Address & ")"
'Lastname, Firstname format
strFileAs = .LastNameAndFirstName
'Company name (email address) format
' strFileAs = .CompanyName & " (" & .Email1Address & ")"
'Comapany Firstname Lastname (email address) format
'the display name will have a leading space if
'the contact doesn't have a company name
'strFileAs = .CompanyName & " " & .FullName & " (" & .Email1Address & ")"
'File As format
'Does not support Company (Fullname) format.
'Only Company name is used in the display name
'strFileAs = .FileAs
Set objOL = Nothing
Set objNS = Nothing
Set obj = Nothing
Set objContact = Nothing
Set objItems = Nothing
Set objContactsFolder = Nothing