unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RzButton, ComObj;type
  TForm1 = class(TForm)
    RzButton1: TRzButton;
    procedure RzButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.RzButton1Click(Sender: TObject);
var
  excel,excelsheet:variant;
begin
  try 
    excel:=createoleobject( 'excel.application ');
    excelsheet:=createoleobject( 'excel.sheet ');
  except
    showmessage( '您的机器里未安装Microsoft   Excel. ');
    exit;
    excelsheet:=excel.workbooks.open( '文件名 ');
    excel.visible:=true;
  end;
end;end.运行时, 显示的报错:Project Project1.exe raised exception class EOleSysError with message '无效的类字符串'. Process stopped. Use Step or Run continue.