我想知道如何确定变体是否引用了 OLE 自动化对象。
我正在将一些 Excel 图表导出到 Powerpoint。
我有这个代码:
var PptFile: Variant;
....
// PptFile _might_ be initialized:
PptFile:=pptApp.Presentations.Open(pptFilename);
// It depends on whether the export has items which need to be exported to
// Powerpoint or not
....
// I would like to determine if PptFile does reference an OLE automated object or not
PptFile.SaveAs(excelFileName+'.pptx');
我知道,可以通过将代码的最后一行(使用 saveAs)放在 之间来完成try...except...end
,但我觉得这种方法不够好。
我正在阅读关于VarIsEmpty
, VarIsEmptyParam
, Nothing , this question的内容,但我不确定。