Email Preview before send

Xenix

Registered User.
Local time
Today, 21:26
Joined
Oct 8, 2001
Messages
124
I am having problems with my code to send emails, the code works fine but I want to be able to edit the email before it sends but I cannot see how to do it :( here is a copy of my code:

'DoCmd.Save acForm, "Quotation"

DoCmd.OpenReport "QuotationEmail", acNormal, "", "
=[Forms]![Quotation]!
"
MsgBox "Please press OK after previewing the quotation in the PDF viewer to send E-Mail", vbOKOnly, "Email Quotation"
'------------------------------------------------------------
' Send Email
' Takes the to message from the form and sends it via outlook
' Also attaches the files listed below
'------------------------------------------------------------
Dim appOutl As Object
Dim MyNameSpace As Object
Dim myemail As Object

On Error GoTo Email_Err

Set appOutl = CreateObject("Outlook.Application")
Set MyNameSpace = appOutl.getNameSpace("MAPI")
Set myemail = appOutl.CreateItem(0)

myemail.To = [Forms]![Quotation]![Email2]
myemail.bcc = [Forms]![Customer]![LocalSalesEmail]

myemail.subject = "Honda Connectors Quotation"
myemail.body = ""
myemail.Attachments.Add "c:\program files\adobe\acrobat 4.0\PDF Output\Custom~1.pdf", , , "Custom~1.pdf"
If Forms!Customer!Terms = False Then
myemail.Attachments.Add "c:\program files\adobe\acrobat 4.0\PDF Output\Terms.pdf", , , "Terms.pdf"
Forms!Customer!Terms = True
End If
myemail.Send


Kind regards and thank you in advance

Mike
 
The first part of your code: DoCmd.OpenReport "QuotationEmail", acNormal, etc
If you replace acNormal with acViewPreview then the report will open, but you cant edit a report, only view the info, but you could change the msgbox message to ask if all is OK
Dave
 
Thank you Dave but that only displays the Report, after this the Report is converted into a PDF with acrobat Distiller then attached to an email. But I want the email box to preview before it just sends it so I can enter a Subject title before it sends also I can check the attachment just to be on the safe side before I send it.
 
Check the VB help for send objects, I see the example has a true/false option at the end to display/bypass the email window. It may lead you to a solution
Good Luck
Dave
 
Thank you Dave,


I have now found a solution, simply rem the line: myemail.Send
and add the line: myemail.Display in the same section.

Just a note for anybody else that wants to do the same thing.


Kind regards

Mike
 
I have done this before by craeting the new mail in the drafts folder. Can't remember the exact code but you set the drafts folder as an Outlook Object, then Create the new mail using the methods of that object. You can then create many mails, and preview and send them at your leisure.
 

Users who are viewing this thread

Back
Top Bottom