alien4u Posted May 12, 2016 Share Posted May 12, 2016 What is on the 1138 row? what make that row different? You must understand that the total amount of row counts is based on column "A" as you see in this line of code: $countRow = .Cells(.Rows.Count, "A").End($xlUp).row So check column A on that row where you script stops. Regards Alien. Link to comment Share on other sites More sharing options...
antmar904 Posted May 12, 2016 Author Share Posted May 12, 2016 The same data format in row 1138 were the script stops is the same as all other rows in colum A Link to comment Share on other sites More sharing options...
antmar904 Posted May 12, 2016 Author Share Posted May 12, 2016 If I add With $oWorkbook.ActiveSheet $countRow = .Cells(.Rows.Count, "A").End($xlUp).row EndWith ConsoleWrite("There are: " & $countRow & " rows in your workbook") Exit is shows the total row count correct. There are: 11400rows in your workbook+>15:10:54 AutoIt3.exe ended.rc:0 Link to comment Share on other sites More sharing options...
alien4u Posted May 12, 2016 Share Posted May 12, 2016 Then for debugging add a ConsoleWrite after your _ExcelRangeWrite() and print the value RangeWrite will write and the value or @error macro, Regards Alien. Link to comment Share on other sites More sharing options...
antmar904 Posted May 12, 2016 Author Share Posted May 12, 2016 30) : ==> The requested action with this object has failed.: Link to comment Share on other sites More sharing options...
antmar904 Posted May 12, 2016 Author Share Posted May 12, 2016 _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $sLastComputer, "M"&$i, "", "") If @error Then ConsoleWrite(@error) EndIf "C:\lncomputernametest.au3" (30) : ==> The requested action with this object has failed.: $lastColvalue = .Cells($i, .Columns.Count).End($xlToLeft).value $lastColvalue = ^ ERROR ->16:01:01 AutoIt3.exe ended.rc:1 Link to comment Share on other sites More sharing options...
alien4u Posted May 13, 2016 Share Posted May 13, 2016 19 hours ago, antmar904 said: _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $sLastComputer, "M"&$i, "", "") If @error Then ConsoleWrite(@error) EndIf "C:\lncomputernametest.au3" (30) : ==> The requested action with this object has failed.: $lastColvalue = .Cells($i, .Columns.Count).End($xlToLeft).value $lastColvalue = ^ ERROR ->16:01:01 AutoIt3.exe ended.rc:1 I mean something like this: For $i = 1 To $countRow With $oWorkbook.ActiveSheet $lastColvalue = .Cells($i, .Columns.Count).End($xlToLeft).value ;MsgBox(0, "", $lastColvalue) $aLastComputer = StringSplit($lastColvalue, ",") $sLastComputer = $aLastComputer[UBound($aLastComputer) - 1] ;MsgBox(0, "", $sLastComputer) ConsoleWrite("The Script about to write: "&$sLastComputer & " in: "& "D"&$i) _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $sLastComputer, "D"&$i, "", "") If @error Then ConsoleWrite(@error) EndIf EndWith Next Anyways you need to be sure the script is always to write in to "D" Column if the position of column is different in one row then you will get an error. Regards Alien. Link to comment Share on other sites More sharing options...
antmar904 Posted May 13, 2016 Author Share Posted May 13, 2016 (edited) The Script about to write: CANPRIWOODWOC13 in: C1038 The Script about to write: CANMISZUFICHC13 in: C1039 The Script about to write: CANSTHLABMACH14 in: C1040 The Script about to write: CANVERWERNICKM1 in: C1041 The Script about to write: CANPRITAYLORJ13 in: C1042 The Script about to write: CANEDMHALLEC11 in: C1043 The Script about to write: -usa\cccanecfw1 in: C1044 The Script about to write: CANBRACUMMINC14 in: C1045 The Script about to write: -usa\cabbnecgm1 in: C1046 The Script about to write: CANMISOSBORNC13 in: C1047 The Script about to write: CANDELELGERTC12 in: C1048 The Script about to write: CANPARWETHERC11 in: C1049 The Script about to write: USATONMASON13 in: C1050 The Script about to write: CANCALROBICHC13 in: C1051 The Script about to write: CANHAMCOOPERC13 in: C1052 The Script about to write: CANSTLLAROSEC12 in: C1053 The Script about to write: CANEDMCONSHIP13 in: C1054 The Script about to write: USATONBARTLEK11 in: C1055 !>14:27:38 AutoIt3.exe ended.rc:-1073741819 +>14:27:38 AutoIt3Wrapper Finished. >Exit code: 3221225477 Time: 32.36 Autoit crashed also Edited May 13, 2016 by antmar904 Link to comment Share on other sites More sharing options...
alien4u Posted May 13, 2016 Share Posted May 13, 2016 @antmar904 You could add @CRLF to your consolewrite to have a better output: ConsoleWrite("The Script about to write: "&$sLastComputer & " in: "& "D"&$i&@CRLF) Please edit your previous post and only show last 10 lines no more than that. Then check what is there in F1073 or F1074, check if row 1074 have something different in the structure, different number of columns or anything that could be causing the problem. Regards Alien. Link to comment Share on other sites More sharing options...
antmar904 Posted May 13, 2016 Author Share Posted May 13, 2016 @alien4u The Script about to write: CANPRIWOODWOC13 in: C1038 The Script about to write: CANMISZUFICHC13 in: C1039 The Script about to write: CANSTHLABMACH14 in: C1040 The Script about to write: CANVERWERNICKM1 in: C1041 The Script about to write: CANPRITAYLORJ13 in: C1042 The Script about to write: CANEDMHALLEC11 in: C1043 The Script about to write: -usa\canecfw1 in: C1044 The Script about to write: CANBRACUMMINC14 in: C1045 The Script about to write: -usa\canecgm1 in: C1046 The Script about to write: CANMISOSBORNC13 in: C1047 The Script about to write: CANDELELGERTC12 in: C1048 The Script about to write: CANPARWETHERC11 in: C1049 The Script about to write: USATONMASON13 in: C1050 The Script about to write: CANCALROBICHC13 in: C1051 The Script about to write: CANHAMCOOPERC13 in: C1052 The Script about to write: CANSTLLAROSEC12 in: C1053 The Script about to write: CANEDMCONSHIP13 in: C1054 The Script about to write: USATONBARTLEK11 in: C1055 !>14:27:38 AutoIt3.exe ended.rc:-1073741819 +>14:27:38 AutoIt3Wrapper Finished. >Exit code: 3221225477 Time: 32.36 Link to comment Share on other sites More sharing options...
water Posted May 13, 2016 Share Posted May 13, 2016 Maybe the cell contains some invalid data that was transfered from LN? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
antmar904 Posted May 13, 2016 Author Share Posted May 13, 2016 the column before the column that list the users computer name is the users lan id. not all rows with have a computer name in the "client machine" column. exp: user "test-usa\cccc" does not list a computer name in column B. can that be the reason why the script is stopping at row 1038? Link to comment Share on other sites More sharing options...
water Posted May 13, 2016 Share Posted May 13, 2016 Maybe that those empty cells contain strange data like Null or whatever. You could check with VarGetType. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
alien4u Posted May 14, 2016 Share Posted May 14, 2016 5 hours ago, antmar904 said: the column before the column that list the users computer name is the users lan id. not all rows with have a computer name in the "client machine" column. exp: user "test-usa\cccc" does not list a computer name in column B. can that be the reason why the script is stopping at row 1038? Yes I think that could be the reason because this 2 lines: $aLastComputer = StringSplit($lastColvalue, ",") $sLastComputer = $aLastComputer[UBound($aLastComputer) - 1] So here you split what is on ClientMachine column and use that to later write $sLastComputer using _ExcelRangeWrite. So something like this should help: If IsArray $aLastComputer Then $sLastComputer = $aLastComputer[UBound($aLastComputer) - 1] _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $sLastComputer, "D"&$i, "", "") Else ConsoleWrite("Skiping row: "&$i &" because there is no Computer Name to Write") EndIf You really need to study and understand what are you doing because if you don't do that then your problems will never end... Regards Alien. Link to comment Share on other sites More sharing options...
antmar904 Posted May 16, 2016 Author Share Posted May 16, 2016 Thank you both for your input however if I remove all blank Client Machine rows the script still stops around the 1053 row. Link to comment Share on other sites More sharing options...
water Posted May 16, 2016 Share Posted May 16, 2016 On 14.5.2016 at 2:40 AM, alien4u said: If IsArray $aLastComputer Then $sLastComputer = $aLastComputer[UBound($aLastComputer) - 1] _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $sLastComputer, "D"&$i, "", "")Else ConsoleWrite("Skiping row: "&$i &" because there is no Computer Name to Write")EndIf You shouldn't remove the empty rows but test what alien4u suggested above. Does it work then? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
antmar904 Posted May 18, 2016 Author Share Posted May 18, 2016 (edited) @water I ran the script again and it's still stopping around row 1037. Its also entering the value of the last cell and not skipping (in this case the value of cell A). "C:\lncomputernametest.au3" (20) : ==> The requested action with this object has failed.: $lastColvalue = .Cells($i, .Columns.Count).End($xlToLeft).value $lastColvalue = ^ ERROR Edited May 18, 2016 by antmar904 Link to comment Share on other sites More sharing options...
antmar904 Posted July 12, 2016 Author Share Posted July 12, 2016 Hi All, It's been awhile that I have not looked at this thread or script I've been working on. The script still stops around row 1022. The script also writes the value of the first column (A) even if there is no other data in that row. We have: If IsArray ($aLastComputer) Then $sLastComputer = $aLastComputer[UBound($aLastComputer) - 1] _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $sLastComputer, "C" & $i, "", "") Else ConsoleWrite("Skiping row: " & $i & " because there is no Computer Name to Write") EndIf But this is not working. Here is the output: "C:\Temp\lncomputernametest.au3" (20) : ==> The requested action with this object has failed.: $lastColvalue = .Cells($i, .Columns.Count).End($xlToLeft).value $lastColvalue = ^ ERROR ->16:41:05 AutoIt3.exe ended.rc:1 +>16:41:05 AutoIt3Wrapper Finished. >Exit code: 1 Time: 13.28 Link to comment Share on other sites More sharing options...
water Posted July 13, 2016 Share Posted July 13, 2016 The snippet of your script and the error message do not fit together Can you please post the latest version of your script? I'm sure you've made some modifications since May. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
antmar904 Posted July 13, 2016 Author Share Posted July 13, 2016 6 hours ago, water said: The snippet of your script and the error message do not fit together Can you please post the latest version of your script? I'm sure you've made some modifications since May. @water expandcollapse popup#include <Excel.au3> Local $oAppl = _Excel_Open() If @error Then ConsoleWrite("ERROR: " & @error) EndIf Local $oWorkbook = _Excel_BookOpen($oAppl, @ScriptDir & "\LNTest.xlsx") ; your workbook here If @error Then ConsoleWrite("ERROR: " & @error) EndIf Global Const $xlUp = -4162 Global Const $xlToLeft = -4159 With $oWorkbook.ActiveSheet $countRow = .Cells(.Rows.Count, "A").End($xlUp).row EndWith ConsoleWrite("There are: " & $countRow & " rows in your workbook") ;Exit For $i = 1 To $countRow With $oWorkbook.ActiveSheet $lastColvalue = .Cells($i, .Columns.Count).End($xlToLeft).value ;MsgBox(0, "", $lastColvalue) $aLastComputer = StringSplit($lastColvalue, ",") $sLastComputer = $aLastComputer[UBound($aLastComputer) - 1] ;MsgBox(0, "", $sLastComputer) ConsoleWrite("The Script about to write: " & $sLastComputer & " in: " & "C" & $i & @CRLF) ;_Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $sLastComputer, "C"&$i, "", "") If IsArray ($aLastComputer) Then ;MsgBox("", "", "I am an array") $sLastComputer = $aLastComputer[UBound($aLastComputer) - 1] _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $sLastComputer, "C" & $i, "", "") Else ConsoleWrite("Skiping row: " & $i & " because there is no Computer Name to Write") ;MsgBox("", "", "I am not an array") EndIf If @error Then ConsoleWrite(@error) EndIf EndWith Next 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