Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preview E-mail before sending in Outlook 1

Status
Not open for further replies.

darall

Instructor
Aug 7, 2002
32
US
I have created a statement based on help from thread702-396121 (Thanks) to send an e-mail in Outlook using fields from my database. I have one problem, I would like to have the e-mail created but not sent. I would like to view the e-mail, in case the message needs to be edited slightly before send, and then manually click on the send button in Outlook. I am fairly new to VBA so any help would be greatly appreciated!

Here is my code, it is run off a button on a form that has three fields; [CCAddress], [Subject] and [Body], all of which are concatenating data from a source table.

***Begin Code***

Private Sub cmdSendEmail_Click()
Dim strEmail, strBody, strSubject, strFrom As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem


Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

strFrom = "GMB-EITSS-Work-Engagement"
strEmail = CCAddress
strSubject = SUBJECT

strBody = MainText

With objEmail
.SentOnBehalfOfName = strFrom
.To = strEmail
.SUBJECT = strSubject
.Body = strBody
.Send

End With

Set objEmail = Nothing
Exit Sub
End Sub

***END CODE***

 
Replace this:
.Send
with this:
.Display

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top