Hiho,
ich habe ein Prob mit folgender Funktion. Diese bricht immer ab (liegt aber an der Func selber, nicht am Aufruf). Kann mir wer sagen, wie man das richten könnte?
Also ich habe nur die Funktion ins Script kopiert:
Fehlermeldung ist:
[autoit]T:\02 - Statistics\FTE\Monthly Reporting\Analyse Master Verknüpfung\Merge_&_Harmonize\MaH.au3 (345) : ==> The requested action with this object has failed.:
$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)^ ERROR
Script ist:
[autoit];===============================================================================
;
; Description: Performs a simplified sort on a range.
; Syntax: _ExcelSort($oExcel, $sKey, $sRangeOrRowStart, $iColStart = 1, $iRowEnd = 1, $iColEnd = 1, $iDirection = 2)
; Parameter(s): $oExcel - An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
; $sKey - The key column or row to sort by (a letter for column, a number for row)
; $sRangeOrRowStart - Either an A1 range, or an integer row number to start from if using R1C1
; $iColStart - The starting column for the number format(left) (default=1)
; $iRowEnd - The ending row for the number format (bottom) (default=1)
; $iColEnd - The ending column for the number format (right) (default=1)
; $iDirection - Sort direction (1=Ascending, 2=Descending) (default=descending)
; Requirement(s): None
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0 and sets @error on errors:
; @error=1 - Specified object does not exist
; @error=2 - Starting row or column invalid
; @extended=0 - Starting row invalid
; @extended=1 - Starting column invalid
; @error=3 - Ending row or column invalid
; @extended=0 - Ending row invalid
; @extended=1 - Ending column invalid
; Author(s): SEO <locodarwin at yahoo dot com>, many thanks to DaLiMan
; Note(s): This sort routine will not function properly with pivot tables. Please
; use the pivot table sorting functions instead.
;
;===============================================================================
Func _ExcelSort($oExcel, $sKey, $sRangeOrRowStart, $iColStart = 1, $iRowEnd = 1, $iColEnd = 1, $iDirection = 2)
If NOT IsObj($oExcel) Then Return SetError(1, 0, 0)
If NOT StringRegExp($sRangeOrRowStart, "[A-Z,a-z]", 0) Then
If $sRangeOrRowStart < 1 Then Return SetError(2, 0, 0)
If $iColStart < 1 Then Return SetError(2, 1, 0)
If $iRowEnd < $sRangeOrRowStart Then Return SetError(3, 0, 0)
If $iColEnd < $iColStart Then Return SetError(3, 1, 0)
$oExcel.Range($oExcel.Cells($sRangeOrRowStart, $iColStart), $oExcel.Cells($iRowEnd, $iColEnd)).Sort _
($oExcel.Range($sKey), $iDirection)
Else
$oExcel.Range($sRangeOrRowStart).Sort ($oExcel.Range($sKey), $iDirection)
EndIf
Return 1
EndFunc ;==>_ExcelSort