![]() |
#10
|
|||
|
|||
![]()
Hm, no, that's not the right tool to make visible what's stored/remained in memory.
You have to distiguish between "validity" of a variable and it's "presence" in memory. These are different things: After passing e.g. "End Sub" the local variable isn't valid anymore and you can't access it - that's true -. But this doesn't mean necessarily that it isn't still alive within memory. The watch window rather points out the validity than its presence in memory (though I'm not 100% sure about this). To get a glimpse on memory you rather need something like ObjPtr() - which of course itself won't work after leaving the sub for local variables. For example have a look at this: - Add a module and put the code. - Add a userform which will be "Userform1" - Then step through the code by F8 and watch the immediate window Code:
Public Sub test() Dim objForm As Object Debug.Print ObjPtr(objForm) Set objForm = UserForm1 Debug.Print ObjPtr(objForm) Set objForm = New UserForm1 Debug.Print ObjPtr(objForm) Set objForm = Nothing Debug.Print ObjPtr(objForm) End Sub Now, I can't proof that this isn't the case if you don't destroy the reference manually but leave it to vba, because I haven't got any idea to read in memory what's in it. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wierd "script code" in a downloaded .doc file | CNBarnes | Word | 2 | 10-18-2012 02:07 AM |
![]() |
krishnaoptif | Word VBA | 9 | 06-22-2012 05:08 AM |
![]() |
Jamal NUMAN | Word | 2 | 07-03-2011 03:11 AM |
Rules and Alerts: "run a script"? | discountvc | Outlook | 0 | 06-15-2010 07:36 AM |
An "error has occurred in the script on this page" | decann | Outlook | 8 | 09-03-2009 08:54 AM |