I have a Global Variable (defined in a Shared Module) called CurrentURL.
At the beginning of each script I have the following code. If the variable is not set I display a User Form where the user enters the URL they want to use, and this is assigned to the CurrentURL variable. This is needed so that when running shells, the user form isn't displayed everytime a new script is run.
If currentURL = "" Then
My problem is that when I stop a script and re-start it, the User Form isn't being displayed, the previous value used for the CurrentURL is being used... Shouldn't variables be cleared once a script is stopped? Note, this also doesn't happen all the time, sometimes it is cleared, so maybe this is a bug?
It is always best to explicitely set a variable value when you need it, and not assume that it will be initialized to the state that you want it. That is one of the biggest headaces that I have seen in developing any kind of software - not initializing variables correctly.
In theory, the variables should be cleared when you restart the script, but obviously, that is not the case here, I suspect because it is a global. I would set up a routine to initialize everything every time you start the script.