Search the Community
Showing results for tags 'excelautomatization'.
-
Hello wise and respected users of this forum! I haven't used autoit for a long time, but now I try to use it to automate a process in excel (I may be better of using VBA, but I would like to refresh my knowladge) I can open/close excel documents, and can interact with them with Send key commands, but I can't really use the _Excel functions Func ExcelRead() ;Local $oExcel = WinGetHandle("Excel") ;WinActivate($oExcel) ;sleep(1000) Local $oExcel = ObjGet("", "Excel.Application") WinActivate($oExcel) WinActivate("Excel") ;$oExcel.Visible = 1 ;$oExcel.workbooks.add If IsObj($oExcel) Then MsgBox($MB_SYSTEMMODAL, "", "The variable is an object") Else MsgBox($MB_SYSTEMMODAL, "", "The variable is not an object") EndIf Local $aResult = _Excel_RangeRead($oExcel, 1, "A1", 1) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 2", "Data successfully read." & @CRLF & "Please click 'OK' to display the formulas of cells A1:C1 of sheet 2.") _ArrayDisplay($aResult, "Excel UDF: _Excel_RangeRead Example 2 - Cells A1:C1 of sheet 2") #cs Local $ValamiExcel = WinGetHandle("Excel") Sleep(1000) WinActivate($ValamiExcel) Local $oRange = $ValamiExcel.ActiveSheet.Range("A").EntireColumn #ce EndFunc This is one of my function and I have a problem here. IsObj tells me the $oExcel is an object, right after that I got the 1 - $oWorkbook is not an object or not a workbook object error Honestly I'm not sure what to do with that, I may have some problems with excel terms (workbook is the "entire" excel file that can have different worksheets right?), but i think my code should work and can't really work around this object not object problem. Thank you for any insight or help that you can share with me! and of course have a nice day
- 4 replies
-
- excel
- excelautomatization
-
(and 1 more)
Tagged with: