Juvigy Posted July 2, 2009 Posted July 2, 2009 The line i got trouble with is : Range(Selection, Selection.End(xlDown)).Select I tried : $oExcel.ActiveSheet.Range($oExcel.Selection , $oExcel.Selection.End(-4121)).Select and $oExcel.ActiveSheet.Range(.Selection , .Selection.End(-4121)).Select but it doesnt work. I got errors like : .Range($oExcel.Selection , $oExcel.Selection.End(-4121)).Select .Range($oExcel.Selection ^ ERROR
GodlessSinner Posted July 2, 2009 Posted July 2, 2009 Now I have'nt installed MSOffice, so try it yourself: #Include <Excel.au3> $oExcel = ObjCreate("Excel.Application") ;$oExcel.visible =1 ;$oExcel.workbooks.add With $oExcel.ActiveSheet .Range(.Selection , .Selection.End(-4121)).Select EndWith _____________________________________________________________________________
zfisherdrums Posted July 3, 2009 Posted July 3, 2009 Hello Juvigy! I found many time that errors I encountered when porting VBA to AutoIt, it was necessary to reference certain objects from $oExcel.Application. For example: $oExcel.ActiveSheet.Range( $oExcel.Application.Selection, $oExcel.Application.Selection.End(-4121) ).Select And as Vitas pointed out, you can use "With": With $oExcel.Application $oExcel.ActiveSheet.Range( .Selection, .Selection.End(-4121)).Select EndWith Hope this helps! Zach... Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog...
Juvigy Posted July 3, 2009 Author Posted July 3, 2009 (edited) Thank you for the pointers Guys! Turned out you have to put the whole "path" of the object in AutoIt which is not like this in VBA: VBA: Range(Selection, Selection.End(xlDown)).Select = AutoIT $oExcel.Application.ActiveSheet.Range($oExcel.Application.Selection , $oExcel.Application.ActiveSheet.Range("A2").End(-4121)).Select Sometimes you can skip part of the "path" but this quite often leads to logic faults difficult to grasp. PS. The above code selects all the used cells from a row bellow the currently selected cell. Edited July 3, 2009 by Juvigy
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