I'm using the following function to send Outlook Email
Public Function SendOutlookEmail(pasEmailAddress, pasEmailCC As Variant, pasEmailSubject As Variant, pasEmailMessage As Variant, pasSendEmail As Boolean) As Boolean
On Error GoTo Err_Proc
Dim NameSpace As Object
Dim EmailSend As Outlook.MailItem
Dim EmailApp As Object
Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.To = Nz(pasEmailAddress, vbNullString)
EmailSend.CC = Nz(pasEmailCC, vbNullString)
EmailSend.Subject = Nz(pasEmailSubject, vbNullString)
EmailSend.Body = Nz(pasEmailMessage, vbNullString)
EmailSend.Send
SendOutlookEmail = True
EmailApp.Quit
Set NameSpace = Nothing
Set EmailApp = Nothing
'-- Cleanup & Exit
myCall = vbNullString
Exit Function
Err_Proc:
SendOutlookEmail = False
Exit Function
End Function
-------------------
Function works great and sends email. However I would like to give the user the option to preview the Email before it is sent. The last parameter (pasSendEmail) is intended to do this.
Is there a property for EmailSend to display the Email on the screen before it is send. The SendObject method has this option, so I thought that Outlook should have it too.
Thanks for your help!
Public Function SendOutlookEmail(pasEmailAddress, pasEmailCC As Variant, pasEmailSubject As Variant, pasEmailMessage As Variant, pasSendEmail As Boolean) As Boolean
On Error GoTo Err_Proc
Dim NameSpace As Object
Dim EmailSend As Outlook.MailItem
Dim EmailApp As Object
Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.To = Nz(pasEmailAddress, vbNullString)
EmailSend.CC = Nz(pasEmailCC, vbNullString)
EmailSend.Subject = Nz(pasEmailSubject, vbNullString)
EmailSend.Body = Nz(pasEmailMessage, vbNullString)
EmailSend.Send
SendOutlookEmail = True
EmailApp.Quit
Set NameSpace = Nothing
Set EmailApp = Nothing
'-- Cleanup & Exit
myCall = vbNullString
Exit Function
Err_Proc:
SendOutlookEmail = False
Exit Function
End Function
-------------------
Function works great and sends email. However I would like to give the user the option to preview the Email before it is sent. The last parameter (pasSendEmail) is intended to do this.
Is there a property for EmailSend to display the Email on the screen before it is send. The SendObject method has this option, so I thought that Outlook should have it too.
Thanks for your help!
