hey everyone
i'm using this code to send mail via outlook

Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
  'Create an Outlook object
  Dim Outlook 'As New Outlook.Application
  Set Outlook = CreateObject("Outlook.Application")
  'Create e new message
  Dim Message 'As Outlook.MailItem
  Set Message = Outlook.CreateItem(olMailItem)
  With Message
    'You can display the message To debug And see state
    .Subject = Subject
    .HTMLBody = TextBody
    'Set destination email address
    .Recipients.Add (aTo)
    If Len(aFrom) > 0 Then .SentOnBehalfOfName = aFrom
    'Set sender address If specified.
    Const olOriginator = 0
    'If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
    'Send the message
  End With
End Sub
i'm sending mail using active directory the problam is when i send using an inputbox and there are two names in the active directory, i get an error...

is there any way to check if there are two names in the active directory before sending and letting the user select the person he ment to send it?

thanks for ur help

Last edited by shabbir; 28May2008 at 16:39.. Reason: Code block