ecoast Posted June 25, 2008 Report Share Posted June 25, 2008 After a search I couldnt find anything on this. Can a Macro be multi-threaded? Say for data entry, launching a web page, to process a csv file and enter data into fields of web page. This has been very time saving for repetitive tasks of course, but to have multiple instances would be wonderful Thanks in advance! Quote Link to comment Share on other sites More sharing options...
rberq Posted June 25, 2008 Report Share Posted June 25, 2008 I'm not sure what you mean by "multi-thread". According to the online Knowledgebase, only one macro can run at a time. However, you can for example get data from one window, then switch to (activate) another window and enter the data, then switch back to the first window, or to still another window, etc.. Or, you could have a macro run in a continuous loop like REPEAT START IF WINDOW-A IS RUNNING ACTIVATE WINDOW-A DO SOME STUFF END IF IF WINDOW-B IS RUNNING ACTIVATE WINDOW-B DO SOME STUFF END IF IF WINDOW-C IS RUNNING ACTIVATE WINDOW-C DO SOME STUFF END IF DELAY BRIEFLY REPEAT END I'm not sure why one would want to do that, though. It's not really multi-threaded, just pseudo-multi. And having a long-running macro like that would block any other macros from running. Usually it would make more sense just to activate a macro based on window name, do whatever stuff you need for that window, then end the macro. Quote Link to comment Share on other sites More sharing options...
hpram99 Posted July 1, 2008 Report Share Posted July 1, 2008 After a search I couldnt find anything on this. Can a Macro be multi-threaded? Say for data entry, launching a web page, to process a csv file and enter data into fields of web page. This has been very time saving for repetitive tasks of course, but to have multiple instances would be wonderful Thanks in advance! What you ask is not multi-threading, it's simply multi-tasking, or running multiple instances of the same macro in answer, no, one macro at a time. What I do to save time is call macros that dynamically write and run vbs files, and not wait for it to finish before continuing in the original macro. Be careful with this, depending on what you're doing, a loop in the macro may launch your vbs as fast as it can, causing 100 instances to start running at once and crash your PC. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.