Reputation: 640
I'm developing an Excel Macro (VBA) which automatically fills an Internet Explorer WebForm with some user data from an Excel Sheet.
Currently the Script works sequentiell. So an IE instance is spinned up, the form is filled with the user data and submited. After that the IE instance is closed. The process will be repeated until all users are processed.
To speed up the process it would be better to spin up multiple IE instances at once and fill the user data in parallel. So how can I run multiple processes/IE instances in VBA?
Upvotes: 1
Views: 77
Reputation: 12602
Create some quantity of IE instances and put them into array. Loop through the array multiply times, check if IE instance's state is ready then start to submit next user's data, and continue with the next IE instance immediately. Continue looping until all users' data uploaded. If necessary close and open the IE instance before new submitting. Do not forget to add DoEvents
statement into the loop.
Be aware that there could be cookies interference, etc. that might not allow the webpages to work in right way simultaneously. Then you may resort to an HTTP request approach with cookies processing, i. e. MSXML2.ServerXMLHTTP
or WinHttp.WinHttpRequest.5.1
.
Upvotes: 1