출처 http://www.guseongwoo.com/tt/1070
Sub 표시방법변경()
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 strName 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
If obj.Class = olContact Then
Set objContact = obj
With objContact
strFirstName = .FirstName
strLastName = .LastName
If (strLastName = "" Or strFirstName = "") Then
strName = .CompanyName
Else
strName = strLastName + strFirstName
End If
.FileAs = strName + IIf(.JobTitle <> "", " " + .JobTitle + "님", "")
If (.Email1Address <> "" And strName <> "") Then
.Email1DisplayName = .FileAs
End If
If (.Email2Address <> "" And strName <> "") Then
.Email2DisplayName = .FileAs
End If
If (.Email3Address <> "" And strName <> "") Then
.Email3DisplayName = .FileAs
End If
If (.FirstName <> "" And .LastName <> "") Then
.FullName = .LastName + .FirstName
End If
.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




댓글을 달아 주세요