autoit 使用excel自带函数操作excel
Looking into the includes <Excel.au3> helped shed some light on things.
To summarize what I've found for others who may be learning as I am.
Direct use of Excel Functions
$MySum = $oExcel.Application.WorksheetFunction.Sum(2,2)
Cell Values from ActiveSheet
$MyVal = $oExcel.Cells(6, 1).Value * .Value is not default as in VBA, must be included
$MyVal = $oExcel.Activesheet.Cells(6, 1).Value
Cell Values, Qualified sheet
$MySum = $oExcel.ActiveWorkbook.Sheets(2).Range("A6").Value
Sum of Cells, as Range
$MySum = $oExcel.Application.WorksheetFunction.Sum($oExcel.ActiveWorkbook.Sheets(2).Range("A1:A10"))
Sum of Cells, Listed, delimited ","
$MySum = $oExcel.Application.WorksheetFunction.Sum($oExcel.ActiveWorkbook.Sheets(2).Range("A1"),$oExcel.ActiveWorkbook.Sheets(2).Range("A2"))
参考地址:https://www.autoitscript.com/forum/topic/154528-excel-functionssubs-exposure/#comment-1116093
posted on 2015-05-19 15:08 jenney.qiu 阅读(5837) 评论(0) 编辑 收藏 举报