Emailing reports as PDFs

megamef

Registered User.
Local time
Today, 01:36
Joined
Apr 18, 2013
Messages
161
Hi All,

I've created an accounts package for my business using access 2003 and I'm just thinking of some time saving features.

We need to email our invoices to our clients.

Normally we print out an invoice, scan it back into the computer, save as a PDF and attach to an email manually one by one.

My package can now print to PDF (saving one step), but what I would like is to be able to print to PDF and attach to a new email (with the email address coming from the customer table) and possibly attach more than one PDF to a single email.

I know you can use
Code:
 DoCmd.SendObject acReport, stDocName
to send a report but I would like it as a PDF as my formatiing is lost using that code and we normally send PDFs to our clients
 
megamef, you can change the format to PDF by using the optional OutputFormat of the DoCmd.SendObject method..
Code:
DoCmd.SendObject acReport, stDocName, [COLOR=Red][B]acFormatPDF[/B][/COLOR]
 
OK, I tried using DoCmd.SendObject acReport, stDocName, acFormatPDF but it didn't change anything.

I still get that same options:

Rich text Format
Microsoft Excel 97-2003
Text Files
Microsoft Excel 5-7
HTML
Snapshot Format

All of these change my report format

Do I need to add a PDF option to that list somehow?
.
 
megamef, maybe you could try this to check where the problem comes from: add in a form a command button with a macro OpenReport (indicate ReportName, View=PrintView, WhereCondition if necessary) and EMailDatabaseObject (ObjectType = Report, OutputFormat=PDF,To,CC,Subject,..).
Also it makes me wonder, is there any option to select when installing Office to enable the "save as PDF" option? I have seen in Word that this PDF thing seems to be an Add-In...

_FabLe_
 
Sorry I did not see your initial post properly.. acFormatPDF was introduced after 2007 (if I am correct) so it will not work.. Try installing some application like CutePDF.. (never used it before, but seems to be an option used by many).. Or try Lebans method of ReportToPDF
 
Thanks for your help everyone but this is a bit beyond me,

I've downloaded Stephen Lebans zip file, I've read the readmefirst file and the how to use file but I'm still none the wiser.

I understand that I need to copy both .dll files to my database directory, but what about the 3 modules? Also where do I put his code from the how to use file? AND THEN how do I incorporate this into the

DoCmd.SendObject acReport, stDocName

command?

In terms of 3rd party PDF software I'm already using DoPDFv7 but this is a printer, the only way to make PDF files with it is to print a document and select it as a printer, I can't save as PDF file any program so i don't think cutePDF will help me.
 
OK, I think I'll abandon the email idea, I've been struggling with Stephen Lebans code for about an hour now and have gotten nowhere, I have at least semi automated the process, but the emailing will have to remain manual as the steps are not obvious.

Thanks everyone who suggested ideas
 
It's something that will likely happen in the future, but my company has very little money at the moment so not something i can see happening too soon. I've actually made some progress with that code since lasting posting and i can now create a pdf from my report but the dotted lines are showing as solid (which i don't want) and still don't know how to attach the PDF as an email.
 
its worth perservering weith stephen lebans code.

an hour or 2 is a small investment.

stephen gives an example of how to use his code that is quite easy to follow.
 
Hi Everyone, A break over the weekend was what I needed to get my head around all the code, anyway I've got it down to this:

Code:
Dim blret
Dim stDocName As String
stDocName = "email invoice"
blret = ConvertReportToPDF(stDocName, vbNullString, "Invoice" & Me.InvoiceNumber & ".pdf", False, False, 0, "", "", 0, 0, 0)

SendMessage True, ("C:\test\invoice" & Me.InvoiceNumber & ".pdf")

I needed to download Stephen Lebans CovertReportToPDF and copy both DLLs into the windows system32 folder and copy all 3 modules from his database into mine,

I then needed to copy the code in step 6 of this page: http://support.microsoft.com/kb/161088
into a new module

I Then needed to download MAPIlab Advanced Security for Outlook V2.0 to stop a waning message appear everytime

Lastly i had to change
Code:
blret = ConvertReportToPDF(stDocName, vbNullString, "Invoice" & Me.InvoiceNumber & ".pdf", False, False, 0, "", "", 0, 0, 0)
to
Code:
blret = ConvertReportToPDF(stDocName, vbNullString, "Invoice" & Me.InvoiceNumber & ".pdf", True, False, 0, "", "", 0, 0, 0)
and specify the folder C:\test for the first file and then change it back so it remembers the file location.

This isn't perfect as a dotted line on my report is coming out solid on the PDF, I've yet to solve this problem but consider it a minor inconvenience rather than a show stopper so might just redesign the report and remove dotted lines.


So yeah it wasn't trivial but was possible, Thanks for all the support, I'll mark this as solved now so people can use this thread in the future if a similar question is asked.
 
Ok, I was little premature with my solved confirmation, but now it is completely, adding the path stopped me needing to select it when i start up so the code is now:

blret = ConvertReportToPDF(stDocName, vbNullString, "c:\test\Invoice" & Me.InvoiceNumber & ".pdf", False, False, 0, "", "", 0, 0, 0)

and I replaced the dotted line with a picture of the dotted line and that solved that problem.
 
Yep thanks pappa smurf. I don't know what software our clients will have on their computers but PDFs are pretty much ubiquitous unlike the snapshot file format which isn't installed by default. As an aside the ConvertReportToPDF add-in actually outputs a snapshot file and then converts it into a PDF to make it's final output.
 

Users who are viewing this thread

Back
Top Bottom