title: What is the proper way to check if Excel OLE is available?
body: <p>I need to test if I can use Excel OLE from my program since it can be launched on PCs without Excel. Code samples on the net assume Excel is installed, but what if not?</p>
  
  <pre><code>XLApp := CreateOleObject('Excel.Application');
  try
    // Hide Excel
    XLApp.Visible := False;
    // Open the Workbook
    XLApp.Workbooks.Open(aPath);
    ...snip...
  finally
    // Quit Excel
    if not VarIsEmpty(XLApp) then
    begin
      XLApp.Quit;
      XLAPP := Unassigned;
    end;
  end;
  </code></pre>
  
  <p>Would that be correct code to find if Excel is installed? </p>
  
  <pre><code>//Try to create Excel OLE
  try
    XLApp := CreateOleObject('Excel.Application');
  except
    ShowMessage('Error opening Excel');
    Exit;
  end;
  </code></pre>