View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.setup
G
 
Posts: n/a
Default VB script for converting each worksheet into individual pdf fi

I do have Acrobat 6.0 Professional installed. I am trying to run a macro
that would go to each worksheet in a workbook and create a pdf with the name
of the worksheet. I used the codes below but keep getting an error at:

Dim myPDF As PdfDistiller

Thanks again.

G


Sub testmePrint()

Dim wks As Worksheet
Dim PSFileName As String
Dim PDFFileName As String

For Each wks In ActiveWorkbook.Worksheets
With ActiveSheet
PSFileName = "C:\Documents and
Settings\C05354\Desktop\Testing\.ps" & .Name & ".ps"
PDFFileName = "C:\Documents and
Settings\C05354\Desktop\Testing\.pdf" & .Name & ".pdf"
.Parent.PrintOut copies:=1, preview:=False,
ActivePrinter:="Adobe PDF", PrintToFile:=True, collate:=True,
prtoFilename:=PSFileName

Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""
End With

Next wks

End Sub



"Barb Reinhardt" wrote:

I assume you have the ability to Print to PDF? If you don't, a macro won't
do it.

"G" wrote in message
...
I have a workbook with 80 worksheets. How do I create a macro that will
automatically convert each worksheets into pdf files?

Your help is greatly appreciated.