Reizvoller Posted March 31, 2016 Posted March 31, 2016 Hello, I am making a simple script to read a range of cells in a spread sheet and return the first cell's value. Global $sExcelReferencePath = "\refDoc.xls" Local $oExcel = _Excel_Open() Local $oWorkBook = _Excel_BookOpen ($oExcel, @ScriptDir&$sExcelReferencePath) Local $iRowVal = 2 Local $propArray[9] = _Excel_RangeRead ( $oWorkbook , "Sheet1", "A2:I2", 1 ) If isArray ($propArray) = 1 Then ConsoleWrite ("yay") Else ConsoleWrite ("Boo") EndIf ConsoleWrite ($propArray[0]) When I run this script , it finds the values and confirms that $propArray is an array but when I try to call $propArray[0] I get back "Array variable has incorrect number of subscripts or subscript dimension range exceeded" Any advice regarding this would be thoroughly appreciated.
Reizvoller Posted March 31, 2016 Author Posted March 31, 2016 I figured out my error. When collecting data from an Excel sheet , even if just a single row, it requires row and column values to designate what portion of the array is to be used/displayed. So $propArray is actually "$propArray[0][9]" and to reference it is the same. Hope this helps some future novice from making the same error I did
Danyfirex Posted March 31, 2016 Posted March 31, 2016 Hi. You don't need to define the array size like Local $propArray[9]= just use Local $propArray= Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Reizvoller Posted March 31, 2016 Author Posted March 31, 2016 Greetings! Thank you for the correction.
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