我正在使用以下代码打开“全局地址列表”窗口以选择列表中的联系人。
对于选择的联系人,我也想获取经理姓名。但是,我似乎无法让它工作。
有什么建议吗?
Private Sub accountManagerName_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim CDOSession, cdoAddressBook, olkRecipients, objAE
On Error Resume Next
Set CDOSession = CreateObject("MAPI.Session")
' Change the name of your Outlook profile as needed.
CDOSession.Logon "", "", False, False
Set olkRecipients = CDOSession.AddressBook(, "Global Address List", 0, False)
For Each objAE In olkRecipients
accountManagerName.Text = objAE.name
'ccManager.Caption = objAE.Manager.name
Next
Set olkRecipients = Nothing
CDOSession.Logoff
Set CDOSession = Nothing
End Sub