830
社区成员




var
xlApp:TOleVariant;
begin
try
SelfControl := False;
XlApp := GetActiveOleObject('Excel.Application'); // connect to running instance except
try
XlApp := CreateOleObject('Excel.Application'); // no running instance, start new.
except
MessageDlg('Unable to start Excel', mtError, [mbOk], 0);
Exit;
end;
//// here comes some code to open / select worksheet, ... etc
Xlapp.Selection.Subtotal(3, xlSum, VarArray(4), True, False, True)
except
end;
refer to http://www.delphigroups.info/2/7/932322.html