Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi all,
i have the following code: Public Sub PrintToPdf(ws As Sheets, out As String) Dim myPDF As PdfDistiller, PSfilename As String, PDFfilename As String Set myPDF = New PdfDistiller ' Define the postscript filename PSfilename = docpath & "temp.ps" ' Define the .pdf filename PDFfilename = out ws.Select ws(1).Activate ActiveSheet.PrintOut Copies:=1, Preview:=False, ActivePrinter:=ChoosePrinter(pdfPrinter), PrintToFile:=True, Collate:=True, PrToFilename:=PSfilename myPDF.FileToPDF PSfilename, PDFfilename, "" Kill docpath & "temp.ps" Kill docpath & "*.log" End Sub which works perfectly, with the exception that it only prints 1 page, not all the sheets in ws. any suggestions on how i can modify this to get it to print all sheets in ws? tia! J |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You've activated one sheet and then said to print activesheet.
Try something like: Public Sub PrintToPdf(ws As Sheets, out As String) Dim myPDF As PdfDistiller, PSfilename As String, PDFfilename As String Set myPDF = New PdfDistiller ' Define the postscript filename PSfilename = docpath & "temp.ps" ' Define the .pdf filename PDFfilename = out ws.PrintOut Copies:=1, Preview:=False, _ ActivePrinter:=ChoosePrinter(pdfPrinter), PrintToFile:=True, Collate:=True, _ PrToFilename:=PSfilename myPDF.FileToPDF PSfilename, PDFfilename, "" Kill docpath & "temp.ps" Kill docpath & "*.log" End Sub HTH, Gareth Gixxer_J_97 wrote: hi all, i have the following code: Public Sub PrintToPdf(ws As Sheets, out As String) Dim myPDF As PdfDistiller, PSfilename As String, PDFfilename As String Set myPDF = New PdfDistiller ' Define the postscript filename PSfilename = docpath & "temp.ps" ' Define the .pdf filename PDFfilename = out ws.Select ws(1).Activate ActiveSheet.PrintOut Copies:=1, Preview:=False, ActivePrinter:=ChoosePrinter(pdfPrinter), PrintToFile:=True, Collate:=True, PrToFilename:=PSfilename myPDF.FileToPDF PSfilename, PDFfilename, "" Kill docpath & "temp.ps" Kill docpath & "*.log" End Sub which works perfectly, with the exception that it only prints 1 page, not all the sheets in ws. any suggestions on how i can modify this to get it to print all sheets in ws? tia! J |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to re install Adobe Acrobat in Excel? The adobe Acrobat work. | Excel Discussion (Misc queries) | |||
Building COM Add-in in XL2003 | Excel Programming | |||
XL2003 Add Ins | Excel Programming | |||
xl2003 and VS | Excel Programming | |||
xl2003 | Excel Programming |