Share via


Outlook) (NameSpace.GetSelectNamesDialog 方法

取得目前會話的 SelectNamesDialog 物件。

語法

expressionGetSelectNamesDialog

表達 代表 '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

另請參閱

NameSpace 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應