• PDF File (2003)

    Author
    Topic
    #430393

    Hi,

    I would like to send report as PDF format as email attachment. I did search all the forms regarding the PDF. I am confuse since there’s two way to do it, one is use link, another one is use print function. Can you advice which one is best to me, or there’s something else is better? I have Access 2003 & Adobe Acrobat 7.0 Professional.

    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #1004798

      I’m not sure what you mean by link vs print.

      A link to a PDF file will only work in one of the following situations:

      a) You send the e-mail only to people within your local area network (LAN), and you make the PDF file available on a shared network folder, or on the local intranet.
      You make the PDF available on a web page that the recipients can visit.

      Otherwise, you must send the PDF file itself as attachment.

      • #1004821

        Thanks. Now I am understood how link works is.

        For my situation, I should use print to PDF. Below is my current process to send report of PDF format as email attachment:

        1) Open the report
        2) Select Adobat printer
        3) Select email after PDF open
        4) Change back to my default printer.

        Is anyway to set step 2-4 automatic? I found a sample file regarding automatic change print to Adobat then change back to default printer from the website, but it doesn’t work when I click “Print PDF.” Please check the attachment.

        Thanks

        • #1004833

          I don’t have Acrobat myself, so I cannot test anything, but much of the code in the database you attached is not needed in Access 2002 or higher. You can simply set a printer by using

          Application.Printer = “printer name”

          You can find several examples of sending PDF files in this forum.

          • #1004838

            Thanks.

            I did search in this forum by typing sending PDF files, but I didn’t find any useful information. Can you provide me some examples or detail of printing PDF file.

            Thanks a lot.

            Regards

            • #1004847

              Set PDF filename: set the caption of the report, or see post 322,094.

              Send e-mail with attachment: post 324,559

              I cannot help you with creating PDF files, I have no experience with that.

            • #1004884

              Hi Hans,

              Thanks! After I reviewed post 322,094 and use code provided by Francois, please see below. Everthing is works except the path of PDF folders. Where I should put the path in the code?
              Please review the attached code provide by Francois.

              “This program is tested on a win xp and I don’t know if it will run on other windows version.
              In the attachment you’ll find to txt files.
              Extract them and copy the content of each of the files in a different new module. Save the modules but don’t use the name RunReportAsPDF as this is the name of the sub and a sub may not have the same name as a module.
              For each report you want to run, use an instruction as follow :
              Call RunReportAsPDF(“ReportName”,”PrinterName”)
              Replace ReportName with the name of your report.
              Replace Printer Name with the printer name you find in the registry when the Adobe Distiller is set as default.
              To find this out :
              Set the adobe distiller as default printer.
              Go to Start , Run and type regedit.
              Navigate to the key HKEY_CURRENT_USERSoftwareMicrosoftWIndows NTCurrentVersionWindows
              Look in the right pane form the key Device and note the string. (On my pc it’s : Acrobat Distiller,winspool,Ne01: )
              This is the text you have to use as PrinterName.
              Close the regedit.
              Set you usual printer as default back.”””

              Thanks

            • #1004922

              Immediately above the lines

              ‘ Run the report
              DoCmd.OpenReport …

              insert these lines:

              ‘ Folder where PDF file will be written
              Const sPDFPath = “C:myapparchive”
              ‘ Set file name
              SetPDFFileNames PDFPath & strReportName & “.pdf”

            • #1004992

              Image cropped to 640 pixels wide by HansV

              Thanks.

              I insert the lines but error message pops up. Please see below:

              Thanks

            • #1005000

              I apologize, that is my error. It should have been

              SetPDFFileNames sPDFPath & strReportName & “.pdf”

              (sPDFPath instead of PDFPath)

            • #1005029

              Hi Hans,

              Still have error message, please see below: Thanks

            • #1005033

              As I have told you, I cannot try out these things for myself, since I don’t have Acrobat. So it is all “air code”. If you look through your code, you’ll find what it should have been instead of SetPDFFileNames.

            • #1005066

              Thanks

              I fixed it. Now it works.

            • #1005075

              Hans,

              I find this to be easier to create .PDF files when creating them from Access reports. Your thoughts?

              Dim strDefaultPrinter As String

              ‘Get the default printer being used
              strDefaultPrinter = Application.Printer.DeviceName

              ‘ Switch the Default Printer to print to Adobe
              Set Application.Printer = Application.Printers(“Adobe PDF”)

              ‘Create the PDF File / Print to PDF
              DoCmd.OpenReport “R_EmployeeByDept”

              ‘Reset the printer to the original default printer
              Set Application.Printer = Application.Printers(strDefaultPrinter)

            • #1005077

              As I have said more than once, I don’t have any experience with creating PDF files in code, but your code looks simple.

    Viewing 0 reply threads
    Reply To: PDF File (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: