×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

code by JabbaTheNut’s Thread 223-414162 i can not run

code by JabbaTheNut’s Thread 223-414162 i can not run

code by JabbaTheNut’s Thread 223-414162 i can not run

(OP)
I have been unable to get the code by JabbaTheNut's Thread 223-414162 to run. I am using Windows , Excel 2003,Didtiller 9.5. yes I know it has been a while. I picked it up in 05
I have checked and unchecked the "Rely on system Founts only, Do not use document fonts." I have also removed the extra "t" from "prttoFilename printer line"
I have included my code. Which I can step through to the "Active Printer". line

Tek-Tips Forums http://www.tek-tips.com/
AREA: Programmers/Graphics and Publishing
FORUM: Adobe: Acrobat Forum
SUBJECT: Excel to PDF Using Visual Basic

HANDLE: JabbaTheNut
POSTED ON: Nov 27
QUESTION:
I have used the following VB code to print an Excel range to an Adobe Acrobat .PDF file. The steps to accomplish this are as follows:

1. Print the range to a postscript file using Acrobat Distiller
2. Convert postscript file to .PDF using Acrobat Distiller API.

Make sure that you uncheck the "Do not send fonts to Distiller" option in the Distiller properties. You do this by entering the Distiller properties>>General Tab>>Printing Preferences>>Adobe PDF Settings and uncheck the "Do not send fonts to Distiller" option. You will get an error if you don't do this.

In the Excel Visual Basic Editor, make sure you include a reference to Acrobat Distiller.

Here is the code....
*********************************************
Private Sub CommandButton1_Click()

' Define the postscript and .pdf file names.
Dim PSFileName as String
Dim PDFFileName as String
PSFileName = "c:\myPostScript.ps"
PDFFileName = "c:\myPDF.pdf"
' Print the Excel range to the postscript file
Dim MySheet As WorkSheet
Set MySheet = ActiveSheet
MySheet.Range("myRange").PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prttofilename:=PSFileName
' Convert the postscript file to .pdf
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

End Sub

And that is all there is to it! I hope this tip is helpful to some of you.
Game Over, Man!
**************************************************************
My Code:

Sub PrintCalcs()
'Code for print macro
'uncheck the Rely on system fonts etc..........



' Define the postscript and .pdf file names.
Dim PSFileName As String
Dim PDFFileName As String
PSFileName = "c:\temp\myPostScript.ps"
PDFFileName = "C:\Libraries\Documents\Amydocs110407\B Master Program\PrintTest"
' Print the Excel range to the postscript file
Dim MySheet As Worksheet
Set MySheet = ActiveSheet
MySheet.Range("Summary").PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prtofilename:=PSFileName

' Convert the postscript file to .pdf
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, "Print Test"
End Sub


Thanks, Stubby1933

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close