I don't think this is a terribly difficult question, I just need someone to tell me how to do it. I've been working on this all morning and can't afford to waste anymore time on it.
My problem is simple: I create a .prn file from an excel worksheet, then call the sub that sends the .prn to the distiller and move on to the next excel worksheet and do the same. Problem is, when I get to the second .prn file for distilling, I get an error because the distiller is still open. I know this is the problem because I can even put a stop statement in there and manually close the distiller each time to make it work. HOW DO i GET THE DISTILLER TO CLOSE???? From what I've researched, it seems that the assignment of the object = Nothing and the GC.collect should do it, but it does not.
A rough example of my existing code below does not do that job.
'globalFileArray(global_CTR) = full path of .prn file
For global_CTR = 1 to 10
If globalFileArray(global_CTR) <> nothing then
Call CreatePDF '<-- Calls the PDF creation sub
Dim objDis As New ACRODISTXLib.PdfDistiller
objDis.FileToPDF(globalFileArray(global_CTR), "c:\abc.pdf", "") <-- Errs on 2nd attempt b/c distiller is still open
objDis = Nothing
Catch X as Exception
msgbox(err.description) '<-- Gives me "The server threw an exception"