"This macro calls that macro, which calls .."-how many?
I've jsut finished looking at all the code I have to complete a certain
project. I realized that in some places, I have a macro calling a macro, which calls another one. In fact, it may go four deep, and the "parent" won't close until the last "grandchild" is completed. How many can be *SAFELY* stacked up like this? Is there a point at which you reach instability, with workbooks opening and closing, saving and claculating in macros within macros? Ed |
"This macro calls that macro, which calls .."-how many?
Ed,
When a macro calls a macro which calls a macro, and so on, the "chain" of macros is stored in what is called the Call Stack. The Call Stack can hold several thousand entries before a "Stack Overflow" error occurs, so you should be safe unless you are using recursion, in which a macro calls itself. Logic flaws in recursive procedures are the most common cause of stack overflows. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ed" wrote in message ... I've jsut finished looking at all the code I have to complete a certain project. I realized that in some places, I have a macro calling a macro, which calls another one. In fact, it may go four deep, and the "parent" won't close until the last "grandchild" is completed. How many can be *SAFELY* stacked up like this? Is there a point at which you reach instability, with workbooks opening and closing, saving and claculating in macros within macros? Ed |
"This macro calls that macro, which calls .."-how many?
Thank you - and may I NEVER!! see a thousand macros stacked up! It's hard
enough keeping track of the half-dozen I use for this project! 8\ Ed "Chip Pearson" wrote in message ... Ed, When a macro calls a macro which calls a macro, and so on, the "chain" of macros is stored in what is called the Call Stack. The Call Stack can hold several thousand entries before a "Stack Overflow" error occurs, so you should be safe unless you are using recursion, in which a macro calls itself. Logic flaws in recursive procedures are the most common cause of stack overflows. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ed" wrote in message ... I've jsut finished looking at all the code I have to complete a certain project. I realized that in some places, I have a macro calling a macro, which calls another one. In fact, it may go four deep, and the "parent" won't close until the last "grandchild" is completed. How many can be *SAFELY* stacked up like this? Is there a point at which you reach instability, with workbooks opening and closing, saving and claculating in macros within macros? Ed |
All times are GMT +1. The time now is 08:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com