Solved

.DOC to .PDF in VBA

Posted on 2003-11-05
8
2,728 Views
Last Modified: 2013-12-02
I have Acrobat 5.0 installed so I have access to Acrobat Distiller(acrodist.exe) and other Acrobat components.

This is what I use today:
___________________________________
Dim oConverter As ACRODISTXLib.PdfDistiller
Call LoadDoc(OriginalPath & FileItem.Name)     ' Opens word document
Call SetMark           'Sets a watermark on the .doc

'this will printout the .doc to a postscript file (.ps)
ActiveDocument.PrintOut False, False, , sPSfile, , , , , , , True
ActiveDocument.Close wdDoNotSaveChanges

oConverter.FileToPDF sPSfile, sPDFfile, ""      'converts the .ps file to .pdf
Kill sPSfile    ' delete the temporary .ps file
___________________________________

This method is very slow and there seems to be an extra step that is not needed(printout as .ps could conver the .doc file directly I suppose).

And I'm having trouble on some computers with the printout (ActiveDocument.PrintOut ) no matter what postscript printer I use some computers give me a message to check printer settings bla bla..).

Is there a better/faster/safer method to do this without involving third party apps or using hundreds of rows of code ?
0
Comment
Question by:SNilsson
  • 5
  • 2
8 Comments
 
LVL 49

Accepted Solution

by:
sunray_2003 earned 250 total points
ID: 9686131
0
 
LVL 8

Author Comment

by:SNilsson
ID: 9686412
Well,

Documents(ThisDocument).PrintOut

This could work if (air code):
_________________________________
LastPrinter = Currentprinter

Currentprinter = "Acrobat Distiller"

'I need to set a path and filename here to avoid the save as dialog.
Documents(ThisDocument).PrintOut

Currentprinter = LastPrinter
__________________________________

Any idéas ?





0
 
LVL 8

Author Comment

by:SNilsson
ID: 9692059
No one ?
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 1

Assisted Solution

by:cpgreen
cpgreen earned 250 total points
ID: 9703659
Have you tried.....

ActiveDocument.PrintOut Range:=wdPrintAllPages, OutputFileName:="c:\pdfdoc.pdf", PrintToFile:=True
0
 
LVL 8

Author Comment

by:SNilsson
ID: 9703847
Nope, but I dont see why the Range parmeter should make any difference.
But if your confidend that this will work I can try it.
0
 
LVL 1

Expert Comment

by:cpgreen
ID: 9703947
unsure if it actually works.  I just used ActiveDocument.PrintOut Range:=wdPrintAllPages in my macro but according to the vba help file the above code should work.
0
 
LVL 8

Author Comment

by:SNilsson
ID: 9704037
Yes normaly it does, it works on my computer but on some other computers it does not I allready use the printout command in:
ActiveDocument.PrintOut False, False, , sPSfile, , , , , , , True
But on some computers it just wont work, I will look in to it further when I'm back at work on monday, right now i'm drinking beer and trying to forget about work :)
0
 
LVL 8

Author Comment

by:SNilsson
ID: 9785138
Points awarded for clean-up purpose, I will post again if I find a solution
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question