NameSpace.GetSelectNamesDialog Method (Outlook)
Obtains a SelectNamesDialog object for the current session.
expression A variable that represents a 'NameSpace' object.
A SelectNamesDialog object for the current session. The SelectNamesDialog object supports displaying the Select Names dialog box for the user to select entries from one or more address lists in the current session.
The following code sample shows how to instantiate an instance of SelectNamesDialog for the current session, and use it 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