title: Selecting the first entry of multiple entries when resolving an Outlook recipient
body: <p>I have a function that takes a name and resolves it in Outlook to return the alias for the selected name. This fails when there is more than one entry for the selected name in the address book. e.g. "Smith, Bob" &amp; "Smith, Bob X". If the name I try to resolve is "Smith, Bob X", the code works fine, but plain "Smith, Bob" fails. </p>
  
  <p>I presume when multiple entries are found, Outlook opens the Check Names dialogue (this occurs when I manually resolve names).</p>
  
  <p>When my code finds multiple entries, how do I select the first one?</p>
  
  <pre><code>Function GETTPX(ByVal UserName As String) As String
  Dim objOL As Object
  Dim oRecip As Outlook.Recipient
  Dim oEU As Outlook.ExchangeUser
  Dim oEDL As Outlook.ExchangeDistributionList
  
  Set objOL = CreateObject("Outlook.Application")
  
  Set oRecip = objOL.Session.CreateRecipient(UserName)
  oRecip.Resolve
  If oRecip.Resolved Then
      Set oEU = oRecip.AddressEntry.GetExchangeUser
  End If
  GETTPX = oEU.Alias
  
  Set oRecip = Nothing
  Set objOL = Nothing
  
  End Function
  </code></pre>