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
check this:
http://embedded.eecs.berkeley.edu/video/powerpoint.htm
(this is about powerpt printing to pdf...but cant be different)