Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you could just run your initialization routine manually.
But it may be worth your effort to check to see if the variables are initialized before you use them. Add another variable in a general module: Public VarsAreInitialized As Boolean Then before you rely on them being ok (in each sub that uses them): If varsareinitialized = false then call initializevars end if Have one procedure that does the work: Sub InitializeVars() 'initialize all your variables 'plus this one: VarsAreInitialized = true end sub Wim SKW wrote: Hi, I have some procedures with static variables like "blnInitDone" to prevent a very large and time-consuming piece of code to run more than once. These procedures are typically called when opening the workbook. Now every time I enter and exit design mode, these variables lose their value so the large piece of code gets run again (which isn't necessary). Is there any way to make a procedure run automatically whenever I exit design mode as to initialise the values correctly? Or to link a macro to the "Exit Design Mode" button (but then I guess you have to be able to determine whether you're already in desing mode or not, otherwise the macro also gets run when you enter design mode...) Thanks. -=Wim=- -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run procedure when exit design mode | Excel Discussion (Misc queries) | |||
I can't exit from Design mode anymore | Excel Discussion (Misc queries) | |||
Can't Exit Design Mode | Excel Programming | |||
Can't Exit Design Mode because Control can not be Created | Excel Programming | |||
Enter Excel Design Mode and Exit Design Mode | Excel Programming |