Sephaerius311 Posted February 17, 2016 Share Posted February 17, 2016 Greetings, Trying to figure out the solution here, but I'm new to arrays so it isn't jumping out at me. I've searched the forums and read the AutoIt Wiki, but I'm still not clear on what I need to do. Here's what I've got: Local $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 2) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Func AgencyAdd(Const $acctArray, $hWnd) Local Const $arrayLen = UBound($acctArray) For $i = 0 To $arrayLen - 1 ; Load the first account number from the array Local $acctNum = $acctArray[$i] $iCount += 1 I use $acctNum to pass the value in Column A into a Function that uses ControlSend(). This works fine. Now, what I need to do in this case is update my Usedrange.Columns("A:C") and I need to pass the values in all 3 columns into my sendkeys function. So to elaborate, what I'll be doing is sending the value in A1, followed by B1, followed by C1, then start over, sending A2, then B2, then C2, and so forth. Does this make sense? What I don't understand is how to "define" columns B and C the way that column A is defined as $acctNum. Thank you, Link to comment Share on other sites More sharing options...
water Posted February 17, 2016 Share Posted February 17, 2016 Read columns A to C and you will get a 2D array. I have moved the 3 values into 3 unique variables so you see what I mean. Local $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:C"), 2) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Func AgencyAdd(Const $acctArray, $hWnd) Local Const $arrayLen = UBound($acctArray) For $i = 0 To $arrayLen - 1 ; Load the first account number from the array Local $acctNumA = $acctArray[$i][0] Local $acctNumB = $acctArray[$i][1] Local $acctNumC = $acctArray[$i][2] $iCount += 1 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Sephaerius311 Posted February 17, 2016 Author Share Posted February 17, 2016 water, That worked perfectly, thank you! Link to comment Share on other sites More sharing options...
water Posted February 17, 2016 Share Posted February 17, 2016 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - 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