Set Excel = CreateObject("Excel.Application")
Set ExcelWBk = Excel.Workbooks.Open(txt_ExcelPath)
Set ExcelWS = ExcelWBk.Sheets(1) ' Add this sheet to this Workbook
With ExcelWS
aa = .Cells(2, 1)
bb = .Cells(2, 2)
End With
Excel.Quit
Set ExcelWS = Nothing
Set ExcelWBk = Nothing
Set Excel = Nothing
但这只能是手工去输行数。哪个方法是获取Excel有效数据的总行数的。
Set ExcelWBk = Excel.Workbooks.Open(txt_ExcelPath)
Set ExcelWS = ExcelWBk.Sheets(1) ' Add this sheet to this Workbook
With ExcelWS
aa = .Cells(2, 1)
bb = .Cells(2, 2)
End With
Excel.Quit
Set ExcelWS = Nothing
Set ExcelWBk = Nothing
Set Excel = Nothing
但这只能是手工去输行数。哪个方法是获取Excel有效数据的总行数的。
其实worksheet有很多member/method可以用来操作.