Hi everyone,
I have this problem I been searching a way to do the following:
have a button that will run a macro, that It will print the active set print area on a hard copy then save a copy as a PDF on a set directory. So the user will have only click on a button and will get a hard copy and a pdf copy on a specific file.
My problem is that all the code that i have found will work only if the PDF Distiller is set as a default so the Pdf copy is create just fine but not a hard copy. so if I change the default printer to the printer then can't get the PDF.
Does anyone have any idea how can I get both...
this is one of the code that I have:
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, ""
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Samsung ML-2510 Series on USB002:", Collate:=True
I have this problem I been searching a way to do the following:
have a button that will run a macro, that It will print the active set print area on a hard copy then save a copy as a PDF on a set directory. So the user will have only click on a button and will get a hard copy and a pdf copy on a specific file.
My problem is that all the code that i have found will work only if the PDF Distiller is set as a default so the Pdf copy is create just fine but not a hard copy. so if I change the default printer to the printer then can't get the PDF.
Does anyone have any idea how can I get both...
this is one of the code that I have:
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, ""
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Samsung ML-2510 Series on USB002:", Collate:=True