Can anyone suggest a better way of running the below code maybe without the use of a loop as i intermittenly get "Call was rejected by callee" errors on row := used.Rows(A_Index) & If (row.Cells(12).Text != "TRUE"). I'm not editing anything in Excel although i do have a 3rd party program displaying its data on a sheet via COM. Ive tried inserting sleeps, even ridiculous long sleeps of 10000 and they still appear. When the code works as expected it only take around 3 seconds to execute the maximum number of send commands to Book.exe and the CalcMyArr macro only takes around 3 milliseconds to execute.
Code: Select all
#Persistent
XL := ComObjActive("Excel.application"), used := XL.Sheets(2).UsedRange
SetTimer, Check, 10000
Check:
XL.Run("CalcMyArr")
Sleep, 1000
Loop, % used.Rows.Count
{
row := used.Rows(A_Index)
If (row.Cells(12).Text != "TRUE")
Continue
WinActivate, ahk_exe Book.exe
WinWaitActive, ahk_exe Book.exe
Send, % row.Cells(14).Text "`n" row.Cells(13).Text
}
Return