Solved

.DOC to .PDF in VBA

Posted on 2003-11-05
8
2,713 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
 
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This article shows how to convert a multi-page PDF file into multiple image files, with one image file created for each page of the PDF. It does this by utilizing an excellent, free software package called GraphicsMagick. The solution is amazingly s…
This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles al…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now