Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default xl2003/vba and Acrobat 6.0

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default xl2003/vba and Acrobat 6.0

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to re install Adobe Acrobat in Excel? The adobe Acrobat work. Execl error Excel Discussion (Misc queries) 1 March 17th 05 02:29 AM
Building COM Add-in in XL2003 Alex T Excel Programming 1 July 12th 04 03:53 PM
XL2003 Add Ins Melissa[_2_] Excel Programming 1 October 22nd 03 07:24 PM
xl2003 and VS Alex T Excel Programming 2 September 22nd 03 10:26 AM
xl2003 GUS Excel Programming 0 September 18th 03 08:16 PM


All times are GMT +1. The time now is 07:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"