Sign in to follow this  
Followers 0
rec9140

Excel UDF

2 posts in this topic

I am trying to get the _ExcelSort to work.

Reviewing the headers as per the below.

_ExcelSort($oExcel, $sKey, $sRangeOrRowStart, $iColStart = 1, $iRowEnd = 1, $iColEnd = 1, $iDirection = 2)

This is the error I get:

$oExcel.Range($oExcel.Cells($sRangeOrRowStart, $iColStart), $oExcel.Cells($iRowEnd, $iColEnd)).Sort ($oExcel.Range($sKey), $iDirection)
$oExcel.Range($oExcel.Cells($sRangeOrRowStart, $iColStart), $oExcel.Cells($iRowEnd, $iColEnd)).Sort ($oExcel.Range($sKey), $iDirection)^ ERROR
>Exit code: 1   Time: 0.635

Source is below. I have an open and it reads fine. I need to sort the D column before I put it into the array and here is where I've hit a snag, with the error above.

$oExcel = _ExcelBookOpen($sFilePath,0,False, "", "")

_ExcelSort($oExcel, "D1", 1, 1, 350, 1, 1)

MsgBox(4096, "Errors?", @error & " and " & @extended, 10)

_ExcelBookClose($oExcel, 0, 0)

I've deleted the line to try to remove any time of hidden ASCII etc... Same error.

Share this post


Link to post
Share on other sites



I am trying to get the _ExcelSort to work.

Right off the bat, the _ExcelSort() function is in the full version of ExcelCOM_UDF.au3, not in the more limited UDF version packaged with AutoIt 3.2.13.4 Beta and later as Excel.au3.

Reviewing the headers as per the below.

_ExcelSort($oExcel, $sKey, $sRangeOrRowStart, $iColStart = 1, $iRowEnd = 1, $iColEnd = 1, $iDirection = 2)

This is the error I get:

$oExcel.Range($oExcel.Cells($sRangeOrRowStart, $iColStart), $oExcel.Cells($iRowEnd, $iColEnd)).Sort ($oExcel.Range($sKey), $iDirection)
$oExcel.Range($oExcel.Cells($sRangeOrRowStart, $iColStart), $oExcel.Cells($iRowEnd, $iColEnd)).Sort ($oExcel.Range($sKey), $iDirection)^ ERROR
>Exit code: 1   Time: 0.635

Source is below. I have an open and it reads fine. I need to sort the D column before I put it into the array and here is where I've hit a snag, with the error above.

$oExcel = _ExcelBookOpen($sFilePath,0,False, "", "")

_ExcelSort($oExcel, "D1", 1, 1, 350, 1, 1)

MsgBox(4096, "Errors?", @error & " and " & @extended, 10)

_ExcelBookClose($oExcel, 0, 0)

I've deleted the line to try to remove any time of hidden ASCII etc... Same error.

Note the text from the header of that function:

$sKey - The key column or row to sort by (a letter for column, a number for row)

Try just "D" for the key column, vice "D1".

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  
Followers 0