There was a loop to process n nummber of objects. And there it was getting stuck after some iteration. I couldn't find the exact reason, but tried out some random stuffs and found the classic work-around - "
Delay
".
I replaced
ShowName o.Cases(i).Name
with a loop which puts a delay and try it again and again until it succeeds. You may like to put the limit on number of retries in while like
while attempts < 10
.
Do
If Err.Number <> 0 Then DoEvents : Sleep 2000 : DoEvents : Err.Clear
ShowName o.Cases(i).Name
Loop While Err.Number <> 0
PS:
Sleep
is an API call
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)