Word to PDF using Visual Basic
- From: "Dan Sideen" <dansideen@xxxxxxxxxx>
- Date: Thu, 28 Jul 2005 20:33:19 -0400
I have written a VB program to make automate making pdf files from Word .doc
files. I have
both Word and Acrobat 7 Professional installed, as well as the Acrobat SDK.
Here is the vb function:
Sub Writepdf(infile as string, outfile as string)
Dim X As Printer
frmMain.lblSTatus = "Starting Word" ' show status
frmMain.lblSTatus.Refresh
wrdApp.Visible = False ' hide word
Set wrdDoc = wrdApp.Documents.Open(infile)
frmMain.lblSTatus = "Creating " & outfile 'show status
frmMain.lblSTatus.Refresh
wrdApp.ActivePrinter = "Adobe PDF" ' change the printer
For Each X In Printers ' Set printer to Adobe Acrobat.
If X.DeviceName = "Adobe PDF" Then
Set Printer = X
Exit For
End If
Next
wrdDoc.PrintOut outputfilename:=outfile, printtofile:=True 'this line
makes a ps file??
wrdDoc.PrintOut 'this line makes a pdf file in
the Adobe PDf Default directory
End Sub
If I don't specify an output file name, the application creates a pdf file
with the same name as the word file, but puts it in the "my documents"
folder (acrobat 6), or whatever folder I choose in the Printing Preferences
box (Acrobat 7).
If I do specify a fully qualifite file name , it creates the file where I
want
it, but its actually a postcript file, not a pdf.
Any idea what I am doing wrong?
Is there a commercial product (ocx ) that will simplify this process?
.
- Prev by Date: extract titles from multiple pdf files
- Next by Date: Re: I have an FDF file saved to my disk and would like to use it with a web-based PDF with 'FILLABLE' fields on it.
- Previous by thread: extract titles from multiple pdf files
- Index(es):
Relevant Pages
|