Solved

.DOC to .PDF in VBA

Posted on 2003-11-05
8
2,735 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 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

If you don't know how to downgrade, my instructions below should be helpful.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

752 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