i'm using this code to send mail via outlook
Code:
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
'.Display
.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
.Send
End With
End Sub
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
