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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM