none
Provide initial name for the GetSelectNamesDialog? RRS feed

  • Question

  • Hello.

    I am a novice VBA user and have setup a macro which calls the GetSelectNamesDialog for user name resolution (and eventual email notifications in another macro).

    The user currently types a name into a cell in Excel and the macro fires to resolve the name and replace it with the "Alias" in Outlook's global address list.  if the typed name is not resolved, the macro tries the last name only, and if that is still not resolved it brings up the GetSelectNamesDialog for single name selecting only, and populates the result into the cell.  Works great, but I would like to add a convenience to the user for the case where the GetSelectNamesDialog pops up:  I see in Outlook SelectName dialog that it will fill in the "search" name to filter the list.  I would like to do this with the user last name.  Can I set a property of the dialog or send a string to it as the initial search?  How do they do it in Outlook?  See picture.

    It will not let me attach a code snippet or picture yet.  Will do as soon as able.

    Thank you for your help.

    Aaron

    With picture:

    Monday, October 10, 2016 4:45 PM

Answers

  • Hello Aaron,

    You are interested in the Recipients property of the SelectNamesDialog class which returns a Recipients collection object that represents the recipients selected in the Select Names dialog, or sets a Recipients collection object that represents the initial recipients to be displayed in the Select Names dialog box.

    This property specifies a Recipients collection object that has a Recipients.Count equal to the total number of recipients in the To, Cc, and Bcc edit boxes.

    If you do not set this property before displaying the Select Names dialog box, then the Recipients object represented bySelectNamesDialog.Recipients will have a Recipients.Count equal to zero.

    If the user does not select any names from the Select Names dialog box and clicks OK, SelectNamesDialog.Recipients will return aRecipients collection object with Recipients.Count equal to zero.

    You may find the following links helpful:

    Display Names from the Address Book

    Identify the Global Address List or a Set of Address Lists with a Store


    [custom.development]

    Monday, October 10, 2016 11:31 PM
  • The ambiguous recipient dialog is not exposed by the Outlook Object Model.

    If using Redemption is na option, it exposes the RDOAddressBook.ResolveName method which can show that dialog (if the ShiowDialog parameter is true).

    set Session = CreateObject("Redemption.RDOSession")
    Session.MAPIOBJECT = Application.Session.MAPIOBJECT
    set ab = session.AddressBook
    set ae = ab.ResolveName("d", true)


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, October 12, 2016 4:14 PM

All replies

  • Hello Aaron,

    You are interested in the Recipients property of the SelectNamesDialog class which returns a Recipients collection object that represents the recipients selected in the Select Names dialog, or sets a Recipients collection object that represents the initial recipients to be displayed in the Select Names dialog box.

    This property specifies a Recipients collection object that has a Recipients.Count equal to the total number of recipients in the To, Cc, and Bcc edit boxes.

    If you do not set this property before displaying the Select Names dialog box, then the Recipients object represented bySelectNamesDialog.Recipients will have a Recipients.Count equal to zero.

    If the user does not select any names from the Select Names dialog box and clicks OK, SelectNamesDialog.Recipients will return aRecipients collection object with Recipients.Count equal to zero.

    You may find the following links helpful:

    Display Names from the Address Book

    Identify the Global Address List or a Set of Address Lists with a Store


    [custom.development]

    Monday, October 10, 2016 11:31 PM
  • OP will get more input if this thread should be moved to Outlook Developer Forum.

    Best Regards,
    Asadulla Javed,
    Jadavpore & Asansol

    Tuesday, October 11, 2016 5:22 AM
  • Eugene, it's not letting me add my picture yet (for some reason).  Can you provide an example where I would put the .recipients as one name in the top of the GetSelectNamesDialog box please?

    Wednesday, October 12, 2016 2:22 PM
  • I was just able to add the picture to the original question.  The highlighted name is what I am trying to feed to the GetSelectNamesDialog.  They can do it in Outlook clearly.  Any idea how they do so?  Is it with .recipients, and if so, is there example code out there?

    Thank you much.

    Wednesday, October 12, 2016 2:24 PM
  • The ambiguous recipient dialog is not exposed by the Outlook Object Model.

    If using Redemption is na option, it exposes the RDOAddressBook.ResolveName method which can show that dialog (if the ShiowDialog parameter is true).

    set Session = CreateObject("Redemption.RDOSession")
    Session.MAPIOBJECT = Application.Session.MAPIOBJECT
    set ab = session.AddressBook
    set ae = ab.ResolveName("d", true)


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, October 12, 2016 4:14 PM