Creating email in Access

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

I have the following code which creates an email from Outlook.

Private Sub Command20_Click()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)

Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = Me.Email_Address
.CC = Me.CCEmailAddress
.Subject = Me.Mess_Subject
.HTMLBody = Me.Mess_Text
If Left(Me.Mail_Attachment_Path, 1) <> "<" Then .
.Attachments.Add (Me.Mail_Attachment_Path)
End If
'.DeleteAfterSubmit = True 'This would let Outlook send th note
without storing it in your sent bin
.Send
End With
'MsgBox MailOutLook.Body
Exit Subemail_error:
MsgBox "An error was encountered." & vbCrLf & "The error message is:
" & Err.Description
Resume Error_outError_out
End Sub

Howwever, I want it to just open Outlook & create the mail without sending
it and leaving it open on screen if possible? Is this possible?

If so, if anyone could advise on how to tweak the code I'd really appreciate
it. Although I'm a total VBA newbie so bear that in mind:-)

Many thanks,

Jason
 
From your code, you need to remove the following line:
.Send

This will create an email waiting for you to click on Send button to send it.

Hope this will solve your problem.
 
Back
Top