簡體   English   中英

Excel vba,從 Outlook 檢索聯系人信息,無法檢索位置列

[英]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對象的屬性。 您可能在AddressOfficeLocation屬性之后

以下是取自 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM