Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Email reports as PDF files 1

Status
Not open for further replies.

mahaishan

IS-IT--Management
Oct 13, 2005
5
0
0
GB
Hello,

Hope anyone can help me here!!

Currently, the email attachment is an RTF file, which is simply created by using the VBA command SendObject. However, SendObject (as far as I know) only supports HTML, Text, Excel, RTF, and SnapShot. However, these format would ingore the graphics, lines and some other formatting options.

Is there anyway I can Email reports as PDF files without much user intervention? I have got Acrobat 7.0 installed on my computer on "C:\PRogram Files\Adobe\Acrobat 7.0".

In a perfect world, here's what I would like the application to do:

1) The user opens the report in Print Preview mode. There's a toolbar button named "Email" that they click on.
2) The "Email" button magically takes the active report, converts it to a PDF file, launches the email software, and attaches the PDF file to it.
3) The user adds additional info to the email message, if desired, and clicks Send to send the email, or can cancel the operation at this point.

Thanks in advance!

Haishan xx
 
Hello Tom,

Thanks for replying me. I had a look at the link. But I got confused to which one I can use.

Help!!

haishan
 
Haishan
Since I don't have Adobe Acrobat Distiller on my computer, I have no way to test this code.

What do you mean when you say that you installed it in a module but it doesn't work correctly?

I assume that you have to call the Function below from your Print command...
Function RunReportAsPDF(rptName As String, sPDFPath As String, sPDFName As String)

Alternatively, since I can't test the code...what you might want to do is make a new post in the FORMS forum, including the web link, and asking how to use the code.

Good luck.

Tom

 
Hi Tom,

Is the Adobe Acrobat Distiller the same as Adobe Acrobat 7, ot is it a different package?

Yeah there is Function RunReportAsPDF(rptName As String, sPDFPath As String, sPDFName As String)

All the codes in this link. but i just not sure how to use it.


Haishan
 
Haishan
Does the Adobe Acrobat 7 you have include the ability to print PDF files?

I only have the free version of Acrobat Reader 7, and it doesn't make PDF files.

I know that in previous versions of Acrobat, the Distiller component had to be included, in order for PDF files to be made.

As for the Function RunReportAsPDF(rptName As String, sPDFPath As String, sPDFName As String, I assume that you would Call this from your code, and it would be something like...
RunReportAsPDF("YourReportName", "ThePathToThePDFLocation", "TheNameOfThePDFFile")

Tom

 
Hiya, it does have the function to print. But what i would like is able to send reports as PDF format with a simple click button on the form as:

1) The user opens the report in Print Preview mode. There's a toolbar button named "Email" that they click on.
2) The "Email" button magically takes the active report, converts it to a PDF file, launches the email software, and attaches the PDF file to it.
3) The user adds additional info to the email message, if desired, and clicks Send to send the email, or can cancel the operation at this point.

Can you suggest me the code for this, please?

Thanks in advance!
 
Haishan
I am assuming that you would put a command button on the form that would Call the Function to which I referred in my last post.

Code:
Call RunReportAsPDF("YourReportName", "ThePathWhereYouWantToCreateThePDFFile", "TheNameOfThePDFFile")

Note this part in the module that explains that.

'---------------------------------
'rptName = Microsoft Access report name
' you
'want to create pdf from
'sPDFPath = the directory path where you
' want
'to create the pdf file (ex. - "c:\data\
' ")
'sPDFName = the name of the pdf file you
' are
'wanting to create (ex. - "file001.pdf")

I do note that the module also refers to Windows NT. You may have to change that to Windows XP. But I'm not sure, so try it the way it is and see what happens, then modify as necessary.

As I say, I don't have a version of Adobe that makes PDF files, so don't have a way to test with that product.

Good luck.

Tom
 
Haishan

A warning!
BE AWFULLY, AWFULLY CAREFUL WITH THIS CODE.

I tried to modify it to use with BroadGun pdfMachine (as I don't have Adobe) and it really screwed up my Printers in the Windows Registry. Now whenever I attempt to print something I get a message "You must install a Printer before you can use it."

Tom
 
Haishan
I don't know whether or not you resolved this, but if not I can offer quite a simple solution.

1. Go to and download their Free version of pdfMachine.
2. You can Print a report using pdfMachine, then click on the e-mail tab and send the report to as many people as you would like.

Saves a bunch of coding and pretty easy to use.

Tom
 
I just ran into the same problem as you THWatson. I was hoping maybe you could tell me how you fixed the printers in the windows registry problem?
 
Haishan
To be honest, I don't remember how I fixed things. I probably did a System Restore to take me back to where things were before I tried that code.

As I say, I use Broadgun pdfMachine, and once it is installed I print the report to it and then can mail it to whomever I desire.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top