取得目前工作階段的 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 支援與意見反應。