Hi everyone,
I have included a "Send mail" module in my vb module, but I want to accept the email address from an input box instead of hard-coding the recipients email address because the recipient may be different each given time.
Below is my code:

SENDEMAIL:
 Set OutlookApp = CreateObject("Outlook.Application")
 Set OutlookMail = OutlookApp.CreateItem(0)
 
 OutlookMail.To = "giftxtian@yahoo.com"
 OutlookMail.Subject = "Project Status"
 OutlookMail.Body = "This is VB email test"
 
 If Len(MailAttach) = 0 Then
    OutlookMail.Attachments.Add MailAttach  '"C:\ProjectStatus.xls"
 End If
 
 OutlookMail.Display      'To display the email
 OutlookMail.Send         'To send the email

How can I imbed the input box in the above routine?
Thanks.
GiftX

you will need a textbox, in your form, and set the OutlookMail.To = to the textbox name and put a .text after it.

OutlookMail.To = textboxname.text

Actually,
I don't want a textbox control on my form. All my codes are embedded in a Command control which the users clicks and the whole process is executed.
Thanks anyway.
tgifgemini.

Hi
is there a posibility to do a look up and use email address from Outlook Address book - using VB6.?
tgifgemini

Hi tgif,

In Command Click, before u call the above module use InputBox say,

Public EMailID as String
EMailID = InputBox("Enter EMail ID")
If Trim(EMailID) <> "" Then
   'Call The Send Function
End If
 
and change this to:
OutlookMail.To = EMailID

Regards
Veena

QVeen72.
Thanks for your contribution. Your code seem pretty efficient.
Enjoy your day.
tgifgemini.

This article has been dead for over six months. Start a new discussion instead.