取得 OutLook 通訊錄資料 (VB)
' 取得 OutLook 通訊錄資料
Const olFoldeContacts = 10
Dim objApp As Object
Dim myNameSpace As Object
Dim ContactsFolder As Object, ContactItem As Object
Dim i As Integer
On Error Resume Next
Set objApp = CreateObject("Outlook.Application")
Set myNameSpace = objApp.GetNameSpace("MAPI")
Set ContactsFolder = myNameSpace.GetDefaultFolder(olFoldeContacts)
For i = 1 To ContactsFolder.Items.Count
Set ContactItem = ContactsFolder.Items.Item(i)
List1.AddItem ContactItem.FirstName & " " & ContactItem.Email1Address
Next
如有錯誤 歡迎指正