Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel Doc to PDF in VB Dll

Posted on 2004-09-09
3
Medium Priority
?
224 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
3 Comments
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…

971 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