InfraRed Posted July 10, 2014 Share Posted July 10, 2014 Hi. I used this for a long time: $row=$oExcel.ActiveSheet.UsedRange.Rows.Count But in version 3.3.12.0 (1st June, 2014) (Release) Excel UDF was re-written and this code stopped working. I see this: "D:\Dropbox\Test.au3" (8) : ==> Variable must be of type "Object".: Is there any solution? Thanks. Link to comment Share on other sites More sharing options...
InfraRed Posted July 10, 2014 Author Share Posted July 10, 2014 Oh, I see, now I have to $oExcel1 = _Excel_Open() before _Excel_BookOpen Link to comment Share on other sites More sharing options...
InfraRed Posted July 10, 2014 Author Share Posted July 10, 2014 Now trying to put some Value into cell I see: "C:\Program Files (x86)\AutoIt3\Include\Excel.au3" (876) : ==> Illegal text at the end of statement (one statement per line).: Func _Excel_RangeWrite($oWorkbook, $vWorksheet, $vValue, $vRange = Default, $bValue = Default, $bForceFunc = Default) Func _Excel_RangeWrite($oWorkbook, $vWorksheet, $vValue, $vRange = Default, $bV^ ERROR Using _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F2") Link to comment Share on other sites More sharing options...
water Posted July 10, 2014 Share Posted July 10, 2014 Can you please post the full script? Most of the time the error is caused somewhere else (missing quote etc.). InfraRed 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
InfraRed Posted July 10, 2014 Author Share Posted July 10, 2014 Here it is: #include <Misc.au3> #Include <File.au3> #Include <Array.au3> #include <Excel.au3> #include <Math.au3> $oExcel1 = _Excel_Open(False) $oExcel = _Excel_BookOpen ($oExcel1,"D:\Dropbox\Gold10.xls", 0) $row=$oExcel.ActiveSheet.UsedRange.Rows.Count $SilvemoonA=Int(_Excel_RangeRead ($oExcel, Default , "C" & $row)/1000) $KazzakH=Int(_Excel_RangeRead ($oExcel, Default , "E" & $row)/1000) $DraenorH=Int(_Excel_RangeRead ($oExcel, Default , "G" & $row)/1000) $RavencrestA=Int(_Excel_RangeRead ($oExcel, Default , "I" & $row)/1000) $FrostmaneA=Int(_Excel_RangeRead ($oExcel, Default , "K" & $row)/1000) $SylvanasA=Int(_Excel_RangeRead ($oExcel, Default , "M" & $row)/1000) $RagnarosH=Int(_Excel_RangeRead ($oExcel, Default , "O" & $row)/1000) $TwistingNetherH=Int(_Excel_RangeRead ($oExcel, Default , "Q" & $row)/1000) _Excel_BookClose($oExcel) $oExcel = _Excel_BookOpen ($oExcel1,"D:\Dropbox\gold_stock.xls", 0) _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $DraenorH, "C2") If $DraenorH>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F2") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F2") _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $FrostmaneA, "C3") If $FrostmaneA>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F3") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F3") _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $KazzakH, "C4") If $KazzakH>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F4") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F4") _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $RagnarosH, "C5") If $RagnarosH>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F5") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F5") _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $RavencrestA, "C6") If $RavencrestA>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F6") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F6") _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $SilvemoonA, "C7") If $SilvemoonA>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F7") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F7") _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $SylvanasA, "C8") If $SylvanasA>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F8") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1,"F8") _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, $TwistingNetherH, "C9") If $TwistingNetherH>30 Then _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 0, "F9") Else _Excel_RangeWrite ($oExcel, $oExcel.Activesheet, 1, "F9") _Excel_BookClose($oExcel) _Excel_Close($oExcel1, True, True) Link to comment Share on other sites More sharing options...
water Posted July 10, 2014 Share Posted July 10, 2014 You can't have If / Then / Else on the same line. InfraRed 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
InfraRed Posted July 10, 2014 Author Share Posted July 10, 2014 (edited) But it worked before, and still working in older versions.. Ok, I'll try Edited July 10, 2014 by InfraRed Link to comment Share on other sites More sharing options...
InfraRed Posted July 10, 2014 Author Share Posted July 10, 2014 Omg, really, it works! Thanks a lot. Link to comment Share on other sites More sharing options...
water Posted July 10, 2014 Share Posted July 10, 2014 If you select "Syntax Check" in SciTE you should get error messages showing you where to change your script. InfraRed 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now