DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   VB 6.0 - Accepting value (email address)from Inputbox (http://www.daniweb.com/forums/thread83980.html)

tgifgemini Jul 19th, 2007 2:05 pm
VB 6.0 - Accepting value (email address)from Inputbox
 
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

Mr.Wobbles Jul 19th, 2007 2:42 pm
Re: VB 6.0 - Accepting value (email address)from Inputbox
 
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

tgifgemini Jul 19th, 2007 8:34 pm
Re: VB 6.0 - Accepting value (email address)from Inputbox
 
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.

tgifgemini Jul 19th, 2007 9:02 pm
Look up email addresses from Outlook address book
 
Hi
is there a posibility to do a look up and use email address from Outlook Address book - using VB6.?
tgifgemini

QVeen72 Jul 20th, 2007 3:09 am
Re: VB 6.0 - Accepting value (email address)from Inputbox
 
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

tgifgemini Jul 20th, 2007 10:14 am
Re: VB 6.0 - Accepting value (email address)from Inputbox
 
QVeen72.
Thanks for your contribution. Your code seem pretty efficient.
Enjoy your day.
tgifgemini.


All times are GMT -4. The time now is 7:41 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC