You're correct. It's my computer that fails to perform this task as it sucks up the CPU after few runs. I tried your last suggestion and that increased the number of runs, but still fails as the CPU usage builds up. Thanks for all the time and effort. I guess I'll try it on another high performance computer. If it works, then I'll buy a better computer.I think it's the same issue that my code had.
Basically, if loop is repeated before the process is terminated, that's where it causes issue as Code overwrites "myProgram" with new instance.
The difference is, my code will throw error at ".Terminate" and stops there, where as Shell will not and just moves on to open another.
Edit: Just thought of something. Add following after .Terminate or Taskkill line.
Code:Application.Wait (Now + TimeValue("0:00:05"))
Basically it allows time for the process to be killed before moving on to next loop
Best of luck with everything you're doing,
PJ