Solved

Excel Doc to PDF in VB Dll

Posted on 2004-09-09
3
200 Views
Last Modified: 2013-12-02
This is the code that works in a VB project.  I moved the code to a DLL and it hangs up on the postscript printing.  Any Ideas?

Dim xlApp As Excel.Application
Dim xlWb As Excel.Workbook
Dim xlWs As Excel.Worksheet

Set xlApp = New Excel.Application
xlApp.Visible = False
xlApp.ScreenUpdating = False
'xlApp.ActivePrinter = "Adobe PDF"  this doesn't work

Set xlWb = xlApp.Workbooks.Open("C:\Inetpub\wwwroot\Attorney Assignments\\DFOC.xls")
Set xlWs = xlWb.Worksheets("HC Notice")

'Print it to a PostScript file using Distiller
' this is were I am having problems... the file starts to create but hangs up
xlWs.PrintOut , , , , "Adobe PDF", True, , "C:\TEST.PS"
xlWb.Close
xlApp.Quit
Set xlWs = Nothing
Set xlWb = Nothing
Set xlApp = Nothing

 'Now call distiller to convert the postscript file to PDF
Dim acr As New ACRODISTXLib.PdfDistiller
acr.bShowWindow = False
acr.FileToPDF "c:\test.ps", "C:\pdfdoc.pdf", ""
Set acr = Nothing
'Delete the old PS file
Kill "c:\test.ps"
'Done
0
Comment
Question by:cmagusin
[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
3 Comments
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 500 total points
ID: 12039229
First, I should say that microsoft warns against doing this:

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q257/7/57.ASP&NoWebContent=1

I suspect that you may have a permisssions issue here? If that were true, though, then one would expect an error unless the error can't express itself outside of the .dll.

FtB
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

This article discusses the PaperPort 14 Scanner Connection Tool, which Nuance provides at no charge in order to fix scanning problems in Windows 8. Furthermore, users of PaperPort 14 in Windows 7 and Windows 10 have reported that the tool works in t…
I. Introduction In a previous article (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_6537-PaperPort-Upgrade-How-to-download-and-install-updated-versions-of-PaperPort-11-and-12.html) (now deprecated), I discussed how to upgrad…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 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