取得目前會話的 SelectNamesDialog 物件。
語法
expression。 GetSelectNamesDialog
詞 一個代表「NameSpace」物件的變數。
傳回值
一個用於當前會話的 SelectNamesDialog 物件。 SelectNamesDialog 物件支援顯示「選擇名稱」對話框,讓使用者能從目前會話中的一個或多個位址列表中選擇條目。
範例
以下程式碼範例展示了如何實例化當前會話的 SelectNamesDialog 實例,並用它在類似 Outlook 使用者介面中「 選擇名稱 」對話框的對話框中顯示聯絡人資料夾的條目。
Sub ShowContactsInDialog()
Dim oDialog As SelectNamesDialog
Dim oAL As AddressList
Dim oContacts As Folder
Set oDialog = Application.Session.GetSelectNamesDialog
Set oContacts = _
Application.Session.GetDefaultFolder(olFolderContacts)
'Look for the address list that corresponds with the Contacts folder
For Each oAL In Application.Session.AddressLists
If oAL.GetContactsFolder = oContacts Then
Exit For
End If
Next
With oDialog
'Initialize the dialog box with the address list representing the Contacts folder
.InitialAddressList = oAL
.ShowOnlyInitialAddressList = True
If .Display Then
'Recipients Resolved
'Access Recipients using oDialog.Recipients
End If
End With
End Sub
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。