先在form上放一个OleContainer1,然后执行
try
if (OleContainer1.State = osEmpty) or
(MessageDlg('Delete current OLE object?', mtConfirmation, mbOkCancel, 0) = mrOk) then
begin
OleContainer1.CreateObject( 'Excel.Sheet',false);
OleContainer1.DoVerb(OleContainer1.PrimaryVerb);
OleContainer1.DoVerb(ovShow);
end
else
OleContainer1.OleObject.InsertCanceled := true;
except end;