Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

.DOC to .PDF in VBA

Posted on 2003-11-05
8
Medium Priority
?
2,741 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 49

Accepted Solution

by:
sunray_2003 earned 500 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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 1

Assisted Solution

by:cpgreen
cpgreen earned 500 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

705 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