How can to call a LOOP imacros from VBA?

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Posts: 3
Joined: Wed Jan 05, 2011 11:01 am

How can to call a LOOP imacros from VBA?

Post by dan_micuda » Mon Jan 10, 2011 12:49 pm


Would anyone please tell me how can I call from VBA a LOOP-ing imacros(a imacros macro that should be opened in Play(Loop) mode. And how can I set the number of loop to a specific number.

Thank you for your help,
Dan Micuda
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: How can to call a LOOP imacros from VBA?

Post by Daniel, Tech Support » Fri Jan 14, 2011 2:04 pm

Hi Dan,

If you're using iMacros with VBA/VBS, then you need to use VBA looping, just do iimPlay() in a FOR loop as many times as you wish.

Please do let me know if you need further help with that!

Best regards,
Daniel, iOpus Support
Posts: 5
Joined: Tue Jul 02, 2013 12:11 am

Re: How can to call a LOOP imacros from VBA?

Post by thylow » Mon Oct 14, 2013 7:06 pm

I have the same issue.

My macros has the code.

normally you would hit the Loop Play button in imacros

I'm running this script with VBA Call to iimplay()
but when vba runs it the macro script only runs through the loop once.

is there a play loop call from vba?
Tom, Tech Support
Posts: 3601
Joined: Mon May 31, 2010 4:59 pm

Re: How can to call a LOOP imacros from VBA?

Post by Tom, Tech Support » Tue Oct 15, 2013 11:58 am

Hi thylow,

When calling your macro from a VBA script, you control the looping in your script code. So you need a variable in your code that tracks each iteration of the loop, and then you pass this variable value to your macro using iimSet. You need to change the SET !DATASOURCE_LINE in your macro to reference your user-defined loop variable instead of the built-in !LOOP variable, which is only ever set by iMacros itself when using the Play (Loop) button.

For an example, see the following, which is also installed in your iMacros\Examples\Windows Scripting Host folder:

Tom, iMacros Support
Post Reply