I'm quite the novice, so my code might look not great. About 3 out of 4 times, I will get an error "Call was rejected by Callee. Specifically: Value" when I try to pull data from a cell in excel. On the 4th try, it will probably work as expected.
I know the reason it isn't working is because the excel is doing hundreds of other things while my script tries to pull data from the excel, but I can't find a working solution to have it keep trying.
Here is a snippet my code:
Code: Select all
F6::
wbk := ComObjGet("C:\Users\Trader\Desktop\StellarApplications\spreadsheets\FED FUNDS POSITIONSZ3NBareDashboardStellarMonitoringUpDown.xlsm")
while (-not wbk.Ready) {
sleep 1
}
A1Val := wbk.Sheets("Sheet1").Cells(1, 1).Value ;This is where the issue is
A1Val := Round(A1Val)
Sleep, 50
Return
Code: Select all
F6::
wbk := ComObjGet("C:\Users\Trader\Desktop\StellarApplications\spreadsheets\FED FUNDS POSITIONSStellarSR3MonitoringUpDown.xlsm")
while (-not wbk.Ready) {
sleep 1
}
Sleep, 10
loop
{
try (A1Val := wbk.Sheets("Sheet1").Cells(14, 14).Value, error:=0) ;I'm pretty confident I didn't write this correctly because the script does nothing once it gets here
catch error
sleep 10
if (!error)
break
}
Sleep, 10
loop
A1Val := Round(A1Val)
Return
Thanks!!!