Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Indianapolis, Indiana, USA
    Thanked 0 Times in 0 Posts

    Unload variables (AXP)

    Hello All,
    Is there a way to unload all variables that have been set? I want to erase a number of global variables that I had set earlier.


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Unload variables (AXP)

    You can't "unload" *all* variables - for instance, a variable of type Numeric (Long Integer) occupies 4 bytes for as long as it exists, and there is no way to "undefine" it in code.

    What you *can* do, is:
    <UL><LI>Set object variables to Nothing. Object variables are those you set with

    <font face="Georgia">Set varname = value</font face=georgia>

    instead of

    <font face="Georgia">varname = value</font face=georgia>

    <LI>Erase dynamic arrays - those declared as

    <font face="Georgia">Dim arrayname() As Long</font face=georgia>

    instead of

    <font face="Georgia">Dim arrayname(1 To 5) As Long</font face=georgia>

    Erasing a standard array just sets all its elements to 0 or "" or whatever is appropriate, but for a dynamic array,

    <font face="Georgia">Erase arrayname</font face=georgia>

    releases the memory occupied by the array. You can use

    <font face="Georgia">Erase arrayname1, arrayname2, arrayname3</font face=georgia>[/list]AFAIK, there is no built-in way to do the above in one fell swoop. You will have to write code to do this, enumerating all object variables and dynamic arrays.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts