• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA loop for auto launch/ wait / exit of web browser

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
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.

Best of luck with everything you're doing,

PJ
 
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
Ok my friend, the hard work always pays off :)
I finally found a solution to it. Here what I found in another website:

http://stackoverflow.com/questions/21176638/vba-how-to-force-ignore-continue-past-1004-error

So, all we needed to do was to give instruction to ignore the error that we knew where it was coming from.

I just did the following and the error is gone now:

On Error Resume Next
oExec.Terminate
On Error GoTo 0

Without your help I would never be able to get this going.

Once again, and for the last time, thanks dude!

Cheers
 
I'd recommend monitoring process and resources when you ignore error like that. Most of the time, I'd go with error handling that would treat error symptom or cause specifically. As it can cause unforeseen issues down the line.

But congrats in figuring it out.

Unfortunately, both codes use Windows specific process and can't be replicated in Mac.

See if link below helps.

http://stackoverflow.com/questions/6136798/vba-shell-function-in-office-2011-for-mac
 
I'd recommend monitoring process and resources when you ignore error like that. Most of the time, I'd go with error handling that would treat error symptom or cause specifically. As it can cause unforeseen issues down the line.

But congrats in figuring it out.

Unfortunately, both codes use Windows specific process and can't be replicated in Mac.

See if link below helps.

http://stackoverflow.com/questions/6136798/vba-shell-function-in-office-2011-for-mac
Awesome, I'll check it out. Thanks for the tips. I'll keep my eyes on processes as I'm running the code.

Cheers,

PJ
 
Back
Top