Results 1 to 2 of 2
  1. #1

    Persistent Variable

    I inherited the system I am working on. In it, the old programmer explicitely declared variables in multiple places. And I have no reason why this was done. I just have to work with it until I can make a major revision to the system.

    Therefore, when you look in each person's, you see the variable declared (the below variable name is just for the sake of this example):

    <pre>Public strMyVariable</pre>

    Then in our main template that drives our system, the same variable is again declared:

    <pre>Public strMyVariable</pre>

    The value of that variable, as most variables do, makes a significant impact on the operation of the system. The value of that variable is assigned from a user's choice on a UserForm.

    Late yesterday, I received a call from a user who complained of a particular procedure not working. When I watched as she attempted to run it again, the product seemed to point to a persistent value in strMyVariable from a previous use of our system.

    So, my question is this: Since the variable is explicitely defined in the and in the module for the UserForm which provides the value for the form, can the value assigned to strMyVariable persist after the UserForm is finished and Set UserForm = Nothing?


  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Sun Prairie, Wisconsin, Wisconsin, USA
    Thanked 113 Times in 110 Posts

    Re: Persistent Variable

    Writing from theory (rather than experience or knowledge)...

    If the variable is declared in, won't it persist as long as is running? Do all projects have an implicit reference to
    Charles Kyle Kenyon
    Madison, Wisconsin

Posting Permissions

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