title: OLE automation: How to check if a variant references an automation object
body: <p>I would like to know how can i determine, whether a variant is referencing an OLE automation object, or not.</p>
  
  <p>I'm exporting some Excel graphs to Powerpoint.</p>
  
  <p>I have this code:</p>
  
  <pre><code>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');
  </code></pre>
  
  <p>I know, it could be done by placing the last line of the code (with saveAs) between <code>try...except...end</code>, but i don't feel that approach is good enough.</p>
  
  <p>I was reading about <code>VarIsEmpty</code>, <code>VarIsEmptyParam</code>, <a href="https://stackoverflow.com/questions/577894/checking-for-the-variant-value-nothing">Nothing</a>, <a href="https://stackoverflow.com/questions/18533890/invalid-variant-operation-when-comparing-an-olevariant-to-unassigned">this question</a>, but i'm not sure about this.</p>