任何方式来确定什么时候Excel后台打印完成?

我在LotusScript(Lotus Notes)中使用COM来使Excel在一个工作簿中将多个工作表打印到PDFCreator,然后将PDFCreator合并成一个PDF。 问题是调用Excel的PrintOut方法紧跟着PDFCreator的cCombineAll方法会导致一个或多个工作表从PDF中被省略。 在打印完成之前,Excel的PrintOut方法似乎就会返回。

睡在我的代码作品,但可能不可靠,因为打印时间变化,所以…
有什么Excel属性或方法,我可以打电话来确定是否打印完成?
或者,有没有办法使PrintOut方法阻塞,直到打印完成?
我一直无法在Excel的VBA帮助中find答案。

这个来自excelguru.ca的示例代码表明,您需要使用PDFCreator的cCountOfPrintJobs属性来监视作业何时开始和停止打印。 一旦打印完成,您可以执行任何您需要的其他操作

 Set pdfjob = New PDFCreator.clsPDFCreator ' ...missing out various initialisation steps 'Print the document to PDF ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator" 'Wait until the print job has entered the print queue Do Until pdfjob.cCountOfPrintjobs = 1 DoEvents Loop pdfjob.cPrinterStop = False 'Wait until PDF creator is finished then release the objects Do Until pdfjob.cCountOfPrintjobs = 0 DoEvents Loop pdfjob.cClose 

我认为另一种方法是将“PrintOut”的“Background”参数设置为false。