New Forum | Previous | Next | (P-PDF) Developers
Topic: Conversion Word -> PDF with Adobe Acrobat and VBA
Conf: (P-PDF) Developers, Msg: 126383
Date: 1/27/2005 04:13 AM
I'm trying to do the following in a VBA Word macro:
1. Open several Word-files from a drive, and change them. The changed files are not saved on the drive but only kept in working storage.
2. The changed files are now to be converted to PDF and saved under a predefined path and filename using Adobe Acrobat.
These are my problems:
1. Acrobat makes a .ps file and saves it correctly on the drive. Before making the .pdf, however, it shows the "save file as"-dialogue. After pressing Abort, the .pdf file is created correctly, but saved on the desktop instead of the path I want it to be saved. How can I prevent the "save as" dialogue from showing up and give the correct path to Acrobat?
My users work with Windows 2000, and they don't have local admin rights on their machines, so I can't work with the registry. Sadly, the file Pdfwritr.ini doesn't seem to be available any more with Win2k.
2. Acrobat PFDWriter does not use the changed file in the working storage for conversion but draws the original file from the drive. Is there a way to prevent this?
3. Is it possible to open the new PDF file in Acrobat Reader or print it, using VBA?
I'll be thankful for any hint concerning any one of the above questions!
BTW I'm working with Acrobat and Distiller 5.0.
This is my code:
Public Function Doc2PDF(application As Object, wasserzeichen As
String, WordDocument As String, PDFDocument As String) As Boolean
Dim psFile As String
Dim DefaultPrinter As String
On Error GoTo errhand
'PDFDocument contains the path and filename for the pdf
psFile = PDFDocument & ".ps"
DefaultPrinter = application.ActivePrinter
.ActivePrinter = "Acrobat PDFWriter"
.PrintOut 0, 0, 0, psFile, , , , , , , True
'switch off "Print to file"
.PrintOut , , 4, , , , , , "0", , False
.ActivePrinter = DefaultPrinter