Cory Posted May 2, 2009 Report Share Posted May 2, 2009 I wanted to help folks visualize the whole global and local nature of variables so I created this page. I didn't spend much time on it but I was wondering if folks could critique. Quote Link to comment Share on other sites More sharing options...
terrypin Posted May 2, 2009 Report Share Posted May 2, 2009 I wanted to help folks visualize the whole global and local nature of variables so I created this page. I didn't spend much time on it but I was wondering if folks could critique. Hey, Cory, great stuff! At a brief glance that seems like it's going to be valuable. This is a 'Bank Holiday Weekend' here so husband duties will keep me away from the PC for a couple of days. But I'll study it properly as soon as I get the chance. Might even try a few experimental macros! Thanks for putting in the time and effort to prepare this nice looking page. Maybe ISS can incorporate some of it in the Help? -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
redwards Posted May 4, 2009 Report Share Posted May 4, 2009 That was very good. How deep can a global variable go? If the 'Main' macro call 'Sub1' then 'Sub1' calls 'Sub2' does you example still apply? Quote Link to comment Share on other sites More sharing options...
kevin Posted May 4, 2009 Report Share Posted May 4, 2009 How deep can a global variable go? If the 'Main' macro call 'Sub1' then 'Sub1' calls 'Sub2' does you example still apply? Yes, a global variable is available to the macro it is defined in and all macros called (via Macro Run) below it. The only exception to this is if in a called macro a local variable is defined with the same name as the global variable then that macro will use the local variable instead of the global variable. Quote Link to comment Share on other sites More sharing options...
paul Posted May 4, 2009 Report Share Posted May 4, 2009 Yes, a global variable is available to the macro it is defined in and all macros called (via Macro Run) below it. The only exception to this is if in a called macro a local variable is defined with the same name as the global variable then that macro will use the local variable instead of the global variable. The other exception is that the calling macro must wait for the called macro to terminate, otherwise the concept of global variables becomes meaningless. Quote Link to comment Share on other sites More sharing options...
Cory Posted May 5, 2009 Author Report Share Posted May 5, 2009 The other exception is that the calling macro must wait for the called macro to terminate, otherwise the concept of global macro becomes meaningless.If you read at the bottom of my page I make exactly this point. I used to argue that they were truly global vars but I proved myself wrong. 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.