[英]Excel vba, retrieve contact info from Outlook, cannot retrive location column
我無法獲取聯系人列表的位置部分,它只是顯示為空白。
Sub GetOutlookAddressBook()
Dim objOutlook As Outlook.Application, objAddressList As Outlook.AddressList
Dim oItem As Outlook.AddressEntry, i As Long
Application.ScreenUpdating = False
Set objOutlook = CreateObject("Outlook.Application")
Set objAddressList = objOutlook.Session.AddressLists("Global Address List")
Sheets("Sheet1").Range("A:C").ClearContents
i = 2
For Each oItem In objAddressList.AddressEntries
If oItem.Address <> "" Then
Cells(i, "A") = oItem.Name
Cells(i, "B") = oItem.GetExchangeUser.ALIAS
Cells(i, "C") = oItem.GetExchangeUser.PrimarySmtpAddress
Cells(i, "D") = oItem.GetExchangeUser.Department
Cells(i, "E") = oItem.GetExchangeUser.Location 'cannot get location
i = i + 1
End If
Next
Application.ScreenUpdating = True
End Sub
Location
不是ExchangeUser
對象的屬性。 您可能在Address
或OfficeLocation
屬性之后
以下是取自 Microsoft 文檔中的對象模型的屬性列表
Address
AddressEntryUserType
Alias
Application
AssistantName
BusinessTelephoneNumber
City
Class
Comments
CompanyName
Department
DisplayType
FirstName
ID
JobTitle
LastName
MobileTelephoneNumber
Name
OfficeLocation
Parent
PostalCode
PrimarySmtpAddress
PropertyAccessor
Session
StateOrProvince
StreetAddress
Type
YomiCompanyName
YomiDepartment
YomiDisplayName
YomiFirstName
YomiLastName
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.