Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA PrToFile doesn't create PDF in 6.0 ! ! ! ! ! ! !

Status
Not open for further replies.

innov

Programmer
May 20, 2004
40
US
Howdy Folks.

I've got an EXCEL XP / VBA app which generates PDF's to specific output files automically (no user intervention with an Adobe dialog).

It's quite simple, using the .printout method and the PDFWriter driver as follows:

ActiveWindow.SelectedSheets.PrintOut PrintToFile:=True, _
PrToFileName:=outputname

NOW WITH ACROBAT 6.0 (and the "Adobe PDF" driver), it looks like a .prn or postscript file is created (whatever it is it's NOT pdf).

If I EXPLICITLY print to the Adobe PDF, I'm able to specify the output path/file and the PDF is created fine.

WHY DOESN'T the VBA "print to file" work anymore? IS THERE A WAY TO MAKE IT WORK.

THANKS IN ADVANCE!!!!!! I'm STUCK!!!!

innov
 
Hi Thomas.

Thanks for the reply. ( I actually tried to call you after seeing info through a Google search.)

You're right, that DOES result in a pdf, BUT it also requires user intervention for the "saveas".

I need to progammtically supply the output file name and path (which I do with Acrobat 5.0 fine thru the PrToFileName, etc.)

Am I missing something? THANKS AGAIN FOR YOUR HELP!
 
Sorry I missed your call.

I haven't made a detailed comparison of Acrobat 5 vs. Acrobat 6 and their OLE methods. I gave up on Acrobat's IAC/OLE/Automation as buggy, poorly documented, unsupported, and weak.

Maybe someone else can give you specifics.

But since you HAVE Acrobat 6, you also have Distiller. Why not generate your PostScript, and use Distiller automation to produce the PDF?

What "Save As" are you performing?

If I knew more about the specific project, maybe I'd have some other suggestions.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
The last posting to this issue is several months old, but I've just now encountered the same problem. The app in question worked for many months using Adobe 4.0 and Excel 2000. After upgrading to Adobe 6.0 I get seemingly incongruous results. Manual printing to PDF works fine, but when automating the function using the "PrToFileName" command, the resultant file is 4 - 5 times normal and won't open in Adobe. If I change the file extension to ".ps", Adobe will read it as a postcript file and convert it to PDF, but this then requires the use of the distiller or manually opening and resaving every file (100+).

I'm hoping it's a simple settings issue - Any thoughts?

Thanks
 
Hi innov and folks
how you doing?
I have the exactly problem like you innov!?

Hope you got the solution? and can post it to me.
when it converts, it wants me to "safeas", but i want that the programm runs by itself without my manual action.

I have a rough source code as follows:(i am using acrobat 6.0 professional)

PowerpointDateiUndName = "C:\Dokumente und Einstellungen\PPT.ppt"
PDF_PFAD = "C:\Dokumente und Einstellungen\"
PDF_Datname = "PPT.pdf"
......
PDF_PFAD_UND_DATNAME = PDF_PFAD & PDF_Datname
....
AktivePrinterPDFWRITER = "Acrobat PDFWriter"
....
AktivPrinterMerk = PowerpointDatei.ActivePrinter
PowerpointDatei.ActivePresentation.PrintOptions.ActivePrinter=AktivePrinterPDFWRITER
.....
If AktivePrinterPDFWRITER = "Acrobat PDFWriter"
Then
PowerpointDatei.ActivePresentation.PrintOut(PrinttoFile = True) = PDF_PFAD_UND_DATNAME
End If

please i need your support

thánks
 
Hi lebforces.

Yes, I got to the bottom of this. Turns out that you can only use the PrToFileName option with the PDFWriter up through Acrobat 5.0. In 6.0 and up, while you can still use the PDFWriter explicitly through a dialog, you must use the Distiller in VBA if you don't want user intervention.

See thread223-416162 by "Jabba" for sample code on the Distiller.

FYI - I still use the 5.0 PDFWriter PRINT DRIVER or another vendor's PDF print driver.

HERE'S WHY - With the Distiller (you'll see in the above thread), you have to (1) first print to a .ps (postscript) file, then (2) Call Distiller to convert the .ps to a PDF!!
In my experience, it's taken almost twice as long. And I'm a subscriber to the KISS (keep is simple s--) principle.

Hope this helps.

Innov.







thread223-416162
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top