title: VBA: Creating session persistent objects (hash) in Excel
body: <p>Is it possible in a VBA function (UDF) to create an object that has global scope? I.e persists beyond the runtime of the function? I would want to stick it in a hash with a unique key that I can pass to other functions. I know you can do this in c#/c++ dll's.</p>
  
  <p>The motivation is a heavy duty piece of processing that I don't want to repeat across hundreds of function calls: I want to cache the results so I only need to do once. E.g let's imagine I have a UDF which builds the results object in Cell A1:</p>
  
  <pre><code>=CreateResultsObject(arg1, arg2, arg3...)
  </code></pre>
  
  <p>The function does the heavy work and returns a unique ID string (the key for the object stored in the persistent hash). Cell A1 now contains this string value which I can then pass to other functions: they can then access the cached object in the hash with the key.</p>
  
  <p>Is this possible? If so how?</p>