Error 91 (Object variable or With Block variable not set)
Using the following I get an error printing the second file - the first is ok.
Error-nr: Error 91 (Object variable or With Block variable not set)
Modul: clsPDFCreator
Procedure: cstart
Line: 50030
If I click on Next Command, I get the same error on Line: 50040. Clicking on next Command I get the Windows error popup & PDFCreator terminates.
This is the invoking code
With PDFCreator1
.cVisible = True
.cStart "/NoProcessingAtStartup"
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = strDIRName
.cOption("AutosaveFilename") = CStr(strFileName)
.cOption("AutosaveFormat") = 0
DefaultPrinter = .cDefaultPrinter
.cDefaultPrinter = "PDFCreator"
.cClearCache
OutputFilename = PDFCreator1.cOutputFilename
crpReport1.PageSetup.PaperSize = crPaperLetter
crpReport1.PageSetup.PaperOrientation = iOrin
crpReport1.PrintOut False, 1
' Print the report
.cPrinterStop = False
End With
'Wait until the print job has entered the print queue
Do Until PDFCreator1.cCountOfPrintjobs = 1
DoEvents
Sleep 200
Loop
PDFCreator1.cPrinterStop = False
'Wait until PDF creator is finished then release the objects
Do Until PDFCreator1.cCountOfPrintjobs = 0
DoEvents
Sleep 200
Loop
' Reset the Defalut printer
With PDFCreator1
.cPrinterStop = True
.cDefaultPrinter = DefaultPrinter
Sleep 200
.cClose
End With