Previewing Outlook Email

jaydwest

JayW
Local time
Today, 07:20
Joined
Apr 22, 2003
Messages
340
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! :)
 
Code:
if(MsgBox("See your email?",vbQuestion+vbYesNo,"See Email?")=vbNo) then
   'dont do nothing no email to see
else
   EmailObject.Display
end if

Jon
 
Jon,

Thanks for the reply. I tested it and it opens the email in an Outlook Window in a Word Window (Yes its true). When the email window is open, it also opens a popup asking do you want to save the document?

Is this just my system? Is there any way to open just the Outlook Email Window?

Thanks again.
 
jaydwest said:
Jon,

Thanks for the reply. I tested it and it opens the email in an Outlook Window in a Word Window (Yes its true). When the email window is open, it also opens a popup asking do you want to save the document?

Is this just my system? Is there any way to open just the Outlook Email Window?

Thanks again.

Huh ? In word?
Are you doing something with the word object model?
Use the outlook object model and apply .Display and it opens outlook...not word.
I am using win 2k with office 2k

Jon
 
I know it seems crazy (but them again it's Microsoft). You see the code I'm using. It's shown in the first Post on this Thread.

I'm using Windows XP and Outlook XP. Any thoughts?

I will do some more research tomorrow to see if this is a known problem or if something is screwy on my system.

Thanks again.
 
Jon.

I went out to my client this morning and tested the Preview Email. She said that Outlook 2002 always opens in a Word Window. I guess that's how Microsoft gets full text formatting in Outlook.

Thanks again for your help.

:D
 
Hi,

You may have set Word as your default E-maileditor (this can be set in the Options of Outlook), so that'll be the reason it 'looks like' Word...

For that question about Saving: you must delete the line "EmailApp.Quit" from your code, because your code then tries to close the preview also. I.e. you can put it in the first part of the If-statement:
Code:
if(MsgBox("See your email?",vbQuestion+vbYesNo,"See Email?")=vbNo) then
   EmailApp.Quit
else
   EmailApp.Display
end if
 

Users who are viewing this thread

Back
Top Bottom