Sephaerius311

_Excel_RangeRead Help

4 posts in this topic

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,

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

water,

That worked perfectly, thank you!

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now