View Full Version : Sending mail with VBSCRIPT problem

08-27-2008, 08:38 PM
i'm using this script to automatically send a mail

Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)

Dim Outlook 'As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")

Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = Subject
.HTMLBody = TextBody
.Recipients.Add (aTo)
Const olOriginator = 0
End With
End Sub

i'm using the Active directory to send mail, the problem is when i enter a name to the Sub, if the name (such as John) is common and has more then one match. the Sub breaks...

is there anyway to tell Outlook to open the name check (Ctrl + K) function?

thank in advance...