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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conver to PDF, PrToFileName error

Status
Not open for further replies.

hartwell

Technical User
Apr 18, 2005
80
GB
I am converting a worksheet to PDF using the solution from thread707-416330 how ever I get a argument not found error on PrToFileName argument of PrintOut, could this be because of i am using Excel 8?

Anyone know of solutions other than sendkeys as this will not be possible.

Code:
Sub CommandButton1()

' Define the postscript file name.
Dim PSFileName As String
PSFileName = "F:\Zip\In\myPostScript.ps"

' Print the Excel range to the postscript file
Dim MySheet As Worksheet
Set MySheet = ActiveSheet
MySheet.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, PrToFileName:=PSFileName


End Sub
 
Have you tried to play with the macro recorder to discover the correct syntax ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
i F1'ed it and PrToFilename isnt available and no replacement. Says it is not possible to enter a file name but anything is possible!!!
 
Thought that might have been the case, we have a machine with office 2003 however does not have adobe and company are not going to pay out for any more licences

Any other work arounds? maybe a way of getting sendkeys to work while workstation is locked...
 
There are plenty of free (or very, very cheap) PDF print drivers that you could put on your Office 2003 machine. Examples would be pdf995, PrimoPDF, PDFCreator, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top