Tuesday, June 28, 2005

Email with VB

Code to add email features in VB

Dim objOutlook As Object
Dim objOutlookMsg As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
If Text1.Text <> "" Then
With objOutlookMsg
.To = Text1
'.Cc = "ifneed@copy.com"
.Subject = "checking 1 2 4 "
.Body = "This is the body of message"
.HTMLBody = "HTML version of message"
.Attachments.Add ("c:\Fastcartaskflow1.xls")
.send 'Let´s go!
MsgBox "Mail has been sent successfully", vbInformation, Mail
End With
Else
MsgBox "Please enter the Email Id", vbCritical, Email
End If
Set objOutlookMsg = Nothing
Set objOutlook = Nothing


Comments Pls
Credits: Shreejith G

0 Comments:

Post a Comment

<< Home