首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

VBA代码转Delphi,该怎么处理

2013-02-27 
VBA代码转Delphi如下所示为VBA代码: Selection.Subtotal GroupBy:3, Function:xlSum, TotalList:Array(

VBA代码转Delphi
如下所示为VBA代码: 
Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(4), _
        Replace:=True, PageBreaks:=False, SummaryBelowData:=True
怎么才能转换为delphi代码呢??
vba代码转delphi有没有方便的方法呢? delphi?vba
[解决办法]
没有方便的方法,只能看VBA代码里面参数类型在Delphi里面对应的参数类型是什么,一个个翻译过来。
[解决办法]


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

热点排行