How to Pause an Excel VBA script without freezing excel

D

duadinam

Hello,

I wrote an application that uses a VBA object called iMacros. iMacros
is a browser automation tool. My program uses iMacros to fill forms.
The iMacros object launches a browser and runs its own script in the
browser. While the script is running the VBA program is paused. I
believe this is causing Excel to display 'Not Responding' messages.

I believe I have two possible solutions to this problem:

1) If I pause the VBA program using VBA native methods, will that
eliminate the freezing? the iMacros plugin has a return object that
will return 'True' when the script is complete. Here is pseudocode
explaining the idea:

i. prepare VBA script to pause
ii. play iMacros script
iii. pause VBA script until iMacros object returns true
iv. when iMacros object returns true continue.

I'm not sure if this is possible; the iMacros object might already
pause excel. I have no experience with threading; and I have no idea
what threading options are available in excel.

2) The second solution is stop the program, between each run of the
script, let excel respond to windows so windows doesn't give a 'Not
Responding" message, and then continue.

Any thoughts?

Thanks
 
D

Don Guillett

Hello,

I wrote an application that uses a VBA object called iMacros.  iMacros
is a browser automation tool.  My program uses iMacros to fill forms.
The iMacros object launches a browser and runs its own script in the
browser.  While the script is running the VBA program is paused.  I
believe this is causing Excel to display 'Not Responding' messages.

I believe I have two possible solutions to this problem:

1)  If I pause the VBA program using VBA native methods, will that
eliminate the freezing?  the iMacros plugin has a return object that
will return 'True' when the script is complete.  Here is pseudocode
explaining the idea:

i. prepare VBA script to pause
ii. play iMacros script
iii. pause VBA script until iMacros object returns true
iv. when iMacros object returns true continue.

I'm not sure if this is possible; the iMacros object might already
pause excel.  I have no experience with threading; and I have no idea
what threading options are available in excel.

2) The second solution is stop the program, between each run of the
script, let excel respond to windows so windows doesn't give a 'Not
Responding" message, and then continue.

Any thoughts?

Thanks

Maybe you could have a 2nd macro and in the first then use IF

if true then
run macro 2
else
continue or run macro 3
end if

also explore ENABLEEVENTS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top