1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
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 objICloudFolder 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 objICloudFolder = objNS.Folders("iCloud") Set objICloudContacts = objICloudFolder.Folders("연락처") Set objItems = objICloudContacts.Items For Each obj In objItems If obj.Class = olContact Then Set objContact = obj With objContact strFirstName = .FirstName strLastName = .LastName If (.FirstName <> "" And .LastName <> "") Then .FullName = .LastName + .FirstName End If If (strLastName = "" And strFirstName = "") Then strName = .CompanyName Else strName = strLastName + strFirstName End If If (.JobTitle <> "인턴") Then .FileAs = strName + IIf(.JobTitle <> "" And .FirstName <> "", " " + .JobTitle + "님", " 님") Else .FileAs = strName + " 님" End If 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 .Save End With End If Err.Clear Next Set objOL = Nothing Set objNS = Nothing Set obj = Nothing Set objContact = Nothing Set objItems = Nothing Set objICloudFolder = Nothing Set objICloudContacts = Nothing End Sub |