大家好,我用ado连接了access,功能是:用户从access提数据,然后存到excel文件中去,然后还可以将excel文件中的纪录读回到access库中,导出到excel没有问题,但是从excel导入到access中时,我不知道excel文件中纪录的个数,无法写这个循环语句。用的控件是excelapplication, excelworkbook, excelworksheet, 请问怎么才能得到excel文件中的纪录数?

解决方案 »

  1.   

    if opendialog1.Execute then begin
          ExcelID:=CreateOleObject('Excel.Application');
          ExcelID.workbooks.open(opendialog1.FileName);
          ExcelID.WorkSheets[1].Activate;
          i:=ExcelID.worksheets[1].UsedRange.Rows.Count;
      

  2.   

    b_filedCount :=ExcelApp.ActiveSheet.UsedRange.columns.Count;//返回excel 表中的列数
    b_row :=ExcelApp.ActiveSheet.UsedRange.Rows.Count列数
      

  3.   

    我用的是excelapplication控件,直接从上面拖下来的,没有usedrange属性啊