MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Excel VB Macros

Posted by Morris Chung on January 11, 2002 3:40 AM

Can I set up a VB macro to run continously in the background
once the excel project is opened?

Posted by Mudface on January 11, 2002 4:03 AM

Yes, use the Workbook_Open() sub to call your macro, accessed by double-clicking on the 'Workbook' entry in your VB project explorer.

Posted by Gurlemph on January 11, 2002 11:23 AM

Workbook_Open() will run your macro, but it depends what you mean by "run continuously". If it's code that has to run when you do stuff in the spreadsheet, it will have to trap other events. Also, when the code runs, if it's long, Excel will stop processing and be unresponsive. If you want true background processing you need to run on another thread( by default Excel is single-threaded, except Excel 2002). If that's the case let me know and I can help out.

Posted by Ivan F Moala on January 11, 2002 12:30 PM

Use Workbook_Open() together with Do Events