如何在delphi中使用Excel的增益集(100分)

  • 主题发起人 主题发起人 Change_On_Insta
  • 开始时间 开始时间
C

Change_On_Insta

Unregistered / Unconfirmed
GUEST, unregistred user!
FExcelApplication:=CreateOleObject('Excel.Application');
FExcelApplication.Visible:=true;
FExcelApplication.Workbooks.Add(xlWBatWorkSheet);
excelworksheet1:=FExcelApplication.Workbooks[1].Worksheets['sheet1'];

//-------------------------------------------HERE!!
FExcelApplication.Run('ATPVBAEN.XLA!Histogram',
excelworksheet1.Range('$B$2:$B$3'),
excelworksheet1.Range('$A$11:$J$25'),
excelworksheet1.Range('$C$2:$C$3'),
True, True , True, False);

出錯說Call Cancellation停止呼叫
 

createoleobjct('excel.application');
createoleobject('excel.sheet');
 
不對

再提前
 
FExcelApplication:=createoleobjct('excel.application');
excelworksheet1:=createoleobject('excel.sheet');
FExcelApplication.Workbooks.Add(xlWBatWorkSheet);
excelworksheet1:=FExcelApplication.Workbooks[1].Worksheets['sheet1'];
 
改了一下﹐現在進了一步﹐但是出錯說找不到這個巨集﹐這句代碼我是
用宏錄制的功能發現的﹐應該不會錯太遠?

FExcelApplication.Visible:=true;
FExcelApplication.Workbooks.Add(xlWBatWorkSheet);
excelworksheet1:=FExcelApplication.Workbooks[1].Worksheets['sheet1'];


FExcelApplication.Run('ATPVBAEN.XLA!Histogram',
excelworksheet1.Range['A1','A5'], excelworksheet1.Range['A6','I12'],
excelworksheet1.Range['B3','B5'], True, True
, True, False );

我試過給出絕對巨集的絕對路徑﹐但是也不行﹐該巨集確實存在
 
是也不行
 
你們還真幽默
 
后退
顶部