LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Keeping Variables Alive

On 3 Jun, 21:25, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Any globally declared varaibles are by default static. Normal procedure
variables are created on the stack. The stack is emptied after the procedure
is finished. Global and static variables are created on the heap. The heap is
only unloaded when the project ends (when the spreadsheet is closed). There
is one excpetion to this. If you use the stand alone code line "End" that
clears the heap and all varaibles along with it.


Interesting.
That is what I would expect, but not what I am seeing. I will check
through my program code for an "End" though (with 9000+ lines there is
plenty of scope for it to be hiding in a corner somewere)
However, in a much simpler bit of code I wrote recently I seemed to be
seeing the same thing. In that case a globally declared array of a
wrapper-class for an array of comboboxes was running the "Terminate"
event for each instance as soon as the code which created them was
completed. This either created them and instantly deleted them (with a
well-behaved "Terminate" routine) or left a bunch of orphan controls
on the worksheet (with no event handlers).
In that case I gave up and created the 15 comboboxes manually and copy-
pasted their event handlers 15 times each :-/

Thanks for the pointer, I will do some experiments. At the very least
I now have a new keyword to search on: "Heap"

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping Values in Variables Jurrasicway Excel Programming 2 May 27th 06 12:29 PM
keeping a shape constant regardless of changes in variables Osvy Excel Discussion (Misc queries) 0 March 28th 06 04:49 AM
Keeping variables in a formula Brian Mann Excel Discussion (Misc queries) 1 September 22nd 05 09:13 PM
Keeping a Variables value alive. Chris W[_3_] Excel Programming 1 March 19th 05 11:54 AM
Keeping track of Global variables Stuart[_5_] Excel Programming 3 July 15th 04 02:14 PM


All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"