Public Sub AddRecipient()
Dim oSelect As Outlook.SelectNamesDialog
Dim colRecipients As Outlook.Recipients
Dim oRecip As Outlook.Recipient
Dim oMail As Outlook.MailItem
Set oMail = Application.CreateItem(olMailItem)
Set oSelect = Application.Session.GetSelectNamesDialog
With oSelect
.AllowMultipleSelection = False
.SetDefaultDisplayMode OlDefaultSelectNamesDisplayMode.olDefaultMail
.ForceResolution = True
.Caption = "My Mail Selector Dialog"
.ToLabel = "My To Selector"
.NumberOfRecipientSelectors = OlRecipientSelectors.olShowTo
.Display
If .Recipients.Count = 1 Then
Set oRecip = oMail.Recipients.Add(.Recipients.Item(1).Name)
End If
End With
oMail.Display
End Sub
|