Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Print to PDF through Acrobat 6.0


Please bear with me I know that this has been talked about previously.
I am trying to write a macro that runs automatically every sunday and
then prints multiple worksheets to pdf. I am able to put the code in
that works without a specific file name but everytime I put a
destination filename in and try to open the file it says it is a
corrupted. These are weekly market files which will always be saved in
the same spot so I don't need to have a user pass a file name. Any help
is appreciated.

Thanks,


--
cooter24
------------------------------------------------------------------------
cooter24's Profile: http://www.excelforum.com/member.php...o&userid=29619
View this thread: http://www.excelforum.com/showthread...hreadid=537883

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Print to PDF through Acrobat 6.0

All dozen or so PDF printers I have tested print in two passes: in the first
pass, they create a PostScript file and in the second, they create the PDF
document. I imagine that you are specifying a file name (with extension PDF)
to which to print; ADOBE is printing the PostScript to it and stopping; that
PDF is not in the PDF format but contains PostScript- hence, it is seen as
corrupt. Don't specify a filename.

As far as I know, there is no way of bypassing the prompt for the filename.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Print to PDF through Acrobat 6.0

Hi cooter24

This may help - amend to your requirements.....

Sub PrinttoPDF()
Dim PSFileName As String, PDFFileName As String
Dim myPDF As PdfDistiller, x As String, y As String, wb As Workbook

Set wb = ActiveWorkbook
Application.ActivePrinter = "Adobe PDF on Ne02:"

If wb.Path = "" Then
x = CreateObject("WScript.Shell").SpecialFolders("Desk top") & "\"
y = wb.Name
Else
x = wb.Path & "\"
y = Left(wb.Name, Len(wb.Name) - 4)
End If

PSFileName = x & y & ".ps"
PDFFileName = x & y & ".pdf"

wb.PrintOut , prtofilename:=PSFileName
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

On Error Resume Next
Kill Left(PSFileName, Len(PSFileName) - 2) & "log"
Kill (PSFileName)
End Sub

--

Regards

William

XL2003




"cooter24" wrote in
message ...

Please bear with me I know that this has been talked about previously.
I am trying to write a macro that runs automatically every sunday and
then prints multiple worksheets to pdf. I am able to put the code in
that works without a specific file name but everytime I put a
destination filename in and try to open the file it says it is a
corrupted. These are weekly market files which will always be saved in
the same spot so I don't need to have a user pass a file name. Any help
is appreciated.

Thanks,


--
cooter24
------------------------------------------------------------------------
cooter24's Profile:
http://www.excelforum.com/member.php...o&userid=29619
View this thread: http://www.excelforum.com/showthread...hreadid=537883



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Print to PDF through Acrobat 6.0

cooter24,
To add to the others, from what I understand (but I may be wrong...):
Printing to file gives you a .ps file not a .pdf, despite the fact that you
have given it a .pdf extension. The resulting file can be processed by
Distiller to give a real .pdf file.
You can see this by opening the apparent .pdf in a text editor and comparing
it to a "real" .pdf file.

The easiest way is to by pass this and create a .pdf directly, so forget the
printToFile and filename
The name of the workbook will be used for the file name and the destination
folder will be dependent on the port, as shown in the PrintersAdobe
PDFPropertiesPorts. You can add another port if you want another location.

There are other settings in the pdf print driver that may interfere with
this, one being "Prompt for Adobe PDF filename" which you need to uncheck.

NickHK



"cooter24" wrote in
message ...

Please bear with me I know that this has been talked about previously.
I am trying to write a macro that runs automatically every sunday and
then prints multiple worksheets to pdf. I am able to put the code in
that works without a specific file name but everytime I put a
destination filename in and try to open the file it says it is a
corrupted. These are weekly market files which will always be saved in
the same spot so I don't need to have a user pass a file name. Any help
is appreciated.

Thanks,


--
cooter24
------------------------------------------------------------------------
cooter24's Profile:

http://www.excelforum.com/member.php...o&userid=29619
View this thread: http://www.excelforum.com/showthread...hreadid=537883



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
can't print to adobe acrobat georgef Charts and Charting in Excel 2 July 4th 08 04:52 AM
excel/vba & acrobat 7.0 pro - Print multiple sheets to 1 PDF Gixxer_J_97[_2_] Excel Programming 0 December 9th 05 07:31 PM
Print Acrobat Reader PDF file from VBA Matthias Claes Excel Programming 1 October 28th 05 10:02 AM
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
Print to Adobe Acrobat (2 ws to one file) Michael McClellan Excel Programming 2 June 2nd 04 10:10 AM


All times are GMT +1. The time now is 06:57 AM.

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"