Storing Information in a Scripting Dictionary
Posted on 2013-06-20
I am using a scripting dictionary to store information e.g. captions for userforms. This allows me to populate the userforms with text from outside the VBA project which I find convenient.
My question relates to best practice for scripting dictionary use..
Say, for arguments sake, I have 100 user forms and 1000s of captions. And lets assume the userforms are opened and closed frequently. And lets also assume that the information for each userform comes from a different source...
Should I set the scripting dictionary to Nothing after each instance of its use?
Or, is it ok to let the dictionary grow? (it can't grow indefinitely as its size can't exceed that of the combined information sources).
If killing off the scripting dictionary is not required, then should I load everything at once (e.g. when the document loads) or add to the dictionary bit by bit (e.g. on an as needed basis as each form is used)?
Would it be better to use 1 large dictionary or several small ones (assuming I don't need to set it to nothing after each use).
I guess, in a nutshell, I'd like to know the pros and cons of keeping the dictionary in memory (real impact, ways to avoid any detrimental impact?) versus continually loading and setting to nothing... what's more efficient??
I have more questions, but they may become irrelevant depending on the answers to the above.