Jan 8 2009, 06:59 PM
I'm using Stephen Leban's Report to PDF code to prepare and attach a monthly report to an email group. Everything works very nicely. However, once the email is sent, the "Do you want to save changes to ..." message comes up when closing Outlook. Can this message be eliminated? Changes are not required to be saved.
Jan 9 2009, 12:04 AM
What VBA code are you using?
Jan 9 2009, 11:09 AM
As always, thanks for the interest...
The code is as follows:
Private Sub cmdMailWarrants_Click()
On Error GoTo Err_cmdMailWarrants_Click
'** Dim blRet As Boolean **Original Lebann Code
DoCmd.OpenReport "rptmonthly", acViewPreview
Reports("rptmonthly").Visible = False
Call ConvertReportToPDF("rptmonthly", , "c:\temp\Warrants.pdf", False, False)
DoCmd.Close acReport, "rptmonthly"
'Open Outlook using the Outlook Object Model:
Dim olapp As Object
Dim olns As Object
Dim olfolder As Object
Dim olitem As Object
Dim olattach As Object
Set olapp = CreateObject("Outlook.application")
Set olns = olapp.getnamespace("MAPI")
Set olfolder = olns.getdefaultfolder(6)
Set olitem = olapp.createitem(0)
Set olattach = olitem.attachments
olitem.To = " "
'olitem.cc = "Whomever"
olitem.Subject = "Monthly Warrants"
olitem.body = "See Attachment"
olattach.Add "c:\temp\warrants.pdf", 1
Set olitem = Nothing
Set olfolder = Nothing
Set olns = Nothing
Set olapp = Nothing
Call MsgBox("An error was encountered" & vbCrLf & _
vbCrLf & _
"Description: " & Err.Description & vbCrLf & _
"Error Number: " & Err.Number, , "Error")
Jan 10 2009, 05:33 PM
Any ideas at all?
Jan 11 2009, 02:10 AM
I do not see anthing int he VBA code that sends the Email. What sends the email?
Jan 11 2009, 11:06 AM
The recipients of the report change each month, therefore the email client (Outlook) opens a new outgoing message with the report already created and attached. The user then chooses the recipents from the address book and sends...
The problem is once the Outlook screen is closed, the save message appears and that's what I would like to eliminate...
Jan 11 2009, 04:03 PM
My guess is that this is caused by the user interacting with the email item.
I have always collected all the information for the email within Access and then send it without any user interaction within Outlook..
As a test, I would try asking for the email address in Access. This will allow you to send the email directly without any user interaction. See if this eliminates the "save" message. If it does, then you will know what was causing the issue.
Jan 12 2009, 10:55 AM
That sounds like a possibly elegant soloution but I have no idea how to do something like that from within Access. Can you please supply some more direction
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here