求vba转C#代码 很急该怎么处理
1个回答
展开全部
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;
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;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询