LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Excel to PDF

PK,

Sorry about that, you need references to

AcrobatPDFMaker
Acrobat Distiller

Dan E

"pk" wrote in message ...
Dan, I'm excited here, but I think I need a reference to
something? My code errors on "PDfDistiller" undefined type?

What's missing man?



-----Original Message-----
PK,

Following is a macro I found on the internet (I wish I

could
tell you who wrote it but I can't!) So I give credit to

the
unknown programmer.

Private Sub CommandButton1_Click()
' Define the postscript and .pdf file names.
Dim PSFileName As String
Dim PDFFileName As String
PSFileName = "c:\myPostScript.ps"
PDFFileName = "c:\myPDF.pdf"

' Print the Excel range to the postscript file
Dim MySheet As Worksheet
Set MySheet = ActiveSheet
ActiveSheet.PrintOut copies:=1, preview:=False, _
ActivePrinter:="Acrobat Distiller", printtofile:=True, _
collate:=True, prtofilename:=PSFileName

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

Kill (PSFileName)

End Sub

When run, no prompt's pop up and as you can see, the
name can be specified. Hopefully, you can incorporate

this
into your code.

Dan E


"pk" wrote in

message ...
Hello, I hope someone can help me with this please.

I researched the history of postings on this subject,

and
I got close to resolution, but I never located a

solution.

I am using VBA in Excel with Windows 2000; Acrobat 5
(maybe upgrading to 6.0 in a few months, but I need a
solution now for version 5.0);

I have over a hundred excel files that need to be
separately converted to PDF. My code so far looks like

the
following:

Sheets("Sheet1").Select
ActivePrinter = "Acrobat Distiller on Ne01:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1

Two problems are encountered:

1) I have to press enter on every loop (100+): how can
this be fixed in code?

2) How do I send the output to a specific path?

Your example code would be most appreciated. Thanks in
advance.



.



 
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



All times are GMT +1. The time now is 03:20 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"