Dim OL As New outlook.Application
Dim OLNameS As outlook.NameSpace
Dim OLFolder As outlook.MAPIFolder
'OlContItem 用于接收单个连系人信息
Dim OLContItem As outlook.ContactItem
'OLDistListItem 用于接收组信息
Dim OLDistListItem As DistListItem
Dim i As Integer
Set OLNameS = OL.GetNamespace("MAPI")
Set OLFolder = OLNameS.GetDefaultFolder(olFolderContacts)
'Set sf = OLFolder.Items.Item(10)
For i = 1 To OLFolder.Items.Count
If TypeName(OLFolder.Items.Item(i)) = "DistListItem" Then
Set OLDistListItem = OLFolder.Items.Item(i)
Debug.Print OLDistListItem.Subject
Else
Set OLContItem = OLFolder.Items.Item(i)
'显示联系人信息
Debug.Print OLContItem.FullName & " " & OLContItem.MobileTelephoneNumber
End If
Next
'OLContItem.Close olDiscard
'OLDistListItem.Close olDiscard
OL.Quit
Set OLFolder = Nothing
Set OL = Nothing
'关闭MAPI对话
OL.Quit