in VB 2008 I create managed com object, which I then call from an application. The application runs vbscript* where it's using CreateObject for my object.
In COM object I have a Module with Friend variable, which value is set at the execution time.
If I then run the script 2nd time, I found that the variable in the COM object already has previous value. I expected that CreateObject would re-initialize it.
run the script
set M = createobject("myapp.myobject")
Friend X as string
X = "myvalue"
Set M = Nothing
run the script again
set M = createobject("myapp.myobject")
Friend X as string
At this point, X in the object will already have "Myvalue".
Does anybody know where is this behavior documented? I expected that "createobject" would indeed create new object from scratch, rather than reuse the old one; especially after prior Set M = Nothing
*) The application is using its own script engine based on vbscript. Microsoft used to license VBscript engine to 3rd parties, so they incorporated it in their own product. This is one of them.