SelectNamesDialog object (Outlook)

Displays the Select Names dialog box for the user to select entries from one or more address lists, and returns the selected entries in the collection object specified by the property SelectNamesDialog.Recipients.

Remarks

You can instantiate an instance of the SelectNamesDialog object by calling NameSpace.GetSelectNamesDialog.

The dialog box displayed by SelectNamesDialog.Display is similar to the Select Names dialog box in the Outlook user interface. It observes the size and position settings of the built-in Select Names dialog box. However, its default state does not show Message Recipients above the To, Cc, and Bcc edit boxes. For more information on using the SelectNamesDialog object to display the Select Names dialog box, see Display Names from the Address Book.

Example

The following code sample shows how to use the SelectNamesDialog object to display entries from the Contacts folder in a dialog box that resembles the Select Names dialog box in the Outlook user interface.

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

Methods

Name
Display
SetDefaultDisplayMode

Properties

Name
AllowMultipleSelection
Application
BccLabel
Caption
CcLabel
Class
ForceResolution
InitialAddressList
NumberOfRecipientSelectors
Parent
Recipients
Session
ShowOnlyInitialAddressList
ToLabel

See also

Outlook Object Model Reference

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.