Word to PDF using Visual Basic



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?






.



Relevant Pages

  • Re: Inserting a .PDF into a .DOC
    ... You are copying and pasting text from Acrobat to Word. ... The OP is inserting an Acrobat object into Word. ... If I press CTRL-A in the Reader, ONLY the currently viewed page where the cursor is located becomes highlighted. ... one-page PDF files, and insert the separate PDF files into ...
    (microsoft.public.word.newusers)
  • Re: Reading Pub 2003 files w/ Adobe 5.0
    ... (Now you see why I like Acrobat Standard. ... "Matthew Wilson" wrote in message ... > Is there any way to save the original Publisher 2003 file into a Word ... Acrobat Reader reads .pdf files. ...
    (microsoft.public.publisher)
  • Re: e-mail a hand-drawn sketch
    ... >>Jim Thompson wrote... ... because Acrobat will ... >> happily make pdf files from anything supplied to it, ... For line art, CCITT group 4 is hard to beat ...
    (sci.electronics.design)
  • Re: IE6 and Acrobat
    ... acrobat (open pdf files in explorer) the pdf linkd do not open at all. ... > web browser settings are set correctly on Monday. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Adobe acrobat doesnt close my files?
    ... I use Adobe Acrobat to read tekst from PDF files. ... I move the file in a folder (using the date I got from the text I ...
    (microsoft.public.dotnet.languages.vb)