macro that creat a PDF on a specific folder

Acccessme

Baseband Member
Messages
26
Hi everyone,
I am runing windows XP pro woth Office 2002 and Acrobat writer 5
I am trying to write a macro that will create a PDF on a specific Driver\folder\name.pdf

this is what I have :
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Acrobat distiller:", Collate:=True

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 2
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Filename = "G:\Temp\Seth-quotes" & ActiveSheet.Range("a13").Value
SendKeys Filename & "{ENTER}", False

I print it on paper first and then I want to printer as a PDF and it kind of works but it gives me the screen where it ask me where to save the file.. so I know that the part on red doesn't work on the script.

I want to create two button that will create from a set area a pdf and save it on G:\folder1\filename.pdf
and the other button that same the same area into a file on G:\folder2\filename.pdf

Does anyone have any idea of how to do that.

thanks
AMD

I got this code that works but I have to have Acrobat Distiller as a default printer. What I need to do is print a hard copy and create a PDF on a specific folder automatically. but with this code I can only print a PDF to specific file and no print out. the code is as follow:

Dim PSFileName As String
Dim PDFFileName As String
PSFileName = "G:\Temp\Purvis-quotes\" & ActiveSheet.Range("A13").Value & ".ps"
PDFFileName = "G:\Temp\Purvis-quotes\" & ActiveSheet.Range("A13").Value & ".pdf"

'Print the Excel range to the postscript file
ActiveWindow.SelectedSheets.PrintOut Copies:=1, preview:=False, ActivePrinter:="Adobe distiller on Ne11", _
printtofile:=True, Collate:=True, prtofilename:=PSFileName

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

Does anyone know how can i also print a hard copy or how to create a PDF without having to change the printers defaults

Thanks
 
Back
Top Bottom