CSDN首创.使用VB读OutLook地址本中的人和组:)

王朝vb·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航