| 1 | #include <Excel.au3> |
|---|
| 2 | #include <Array.au3> |
|---|
| 3 | |
|---|
| 4 | Global $fileExcel = "Excel_AutoIt_Bug.xls" |
|---|
| 5 | Global $arrayTest,$objExcelAttached |
|---|
| 6 | |
|---|
| 7 | ;~ _ExcelReadSheetToArray sets @error to 4 when called after the workbook object is attached |
|---|
| 8 | |
|---|
| 9 | $objExcelAttached = _ExcelBookAttach($fileExcel,"FileName") |
|---|
| 10 | $arrayTest = _ExcelReadSheetToArray($objExcelAttached,1,1,1,8) |
|---|
| 11 | If @error <> 0 Then |
|---|
| 12 | ConsoleWrite("Error encountered (" & @error & ") - object was attached and active sheet wasn't changed." & @CRLF) |
|---|
| 13 | EndIf |
|---|
| 14 | $objExcelAttached.Sheets(2).Activate |
|---|
| 15 | $arrayTest = _ExcelReadSheetToArray($objExcelAttached,1,1,1,8) |
|---|
| 16 | If @error <> 0 Then |
|---|
| 17 | ConsoleWrite("Error encountered (" & @error & ") - object was attached and active sheet was changed." & @CRLF) |
|---|
| 18 | EndIf |
|---|
| 19 | _ExcelBookClose($objExcelAttached) |
|---|