顯示 [選取名稱] 對話方塊,讓使用者從一或多個通訊清單中選取項目,並傳回 SelectNamesDialog.Recipients 屬性所指定的集合物件中選取的項目。
註解
您可以透過呼叫 NameSpace.GetSelectNamesDialog,產生 SelectNamesDialog 物件的實例。
SelectNamesDialog.Display 所顯示的對話方塊類似於 Outlook 使用者介面中的 [選取名稱] 對話方塊。 它會遵循內建 [選取名稱] 對話方塊的大小和位置設定。 不過,其預設狀態不會在 [收件者]、[副本] 及 [密件副本] 編輯方塊上方顯示 [郵件收件者]。 如需使用 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
方法
| 名稱 |
|---|
| Display |
| SetDefaultDisplayMode |
屬性
| 名稱 |
|---|
| AllowMultipleSelection |
| Application |
| BccLabel |
| Caption |
| CcLabel |
| Class |
| ForceResolution |
| InitialAddressList |
| NumberOfRecipientSelectors |
| Parent |
| Recipients |
| Session |
| ShowOnlyInitialAddressList |
| ToLabel |
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。