name = some value script, and that can cause strange results when your script is running. This is because when you misspell for example the "name" variable to "nime" the script will automatically create a new variable called "nime". To prevent your script from doing this you can use the Option Explicit statement. When you use this statement you will have to declare all your variables with the dim, public or private statement. Put the Option Explicit statement on the top of your script. Like this: dim name name = some value i = 200 on the right. Now the variable "name" has the value "Hege". When you declare a variable within a procedure, only code within that procedure can access or change the value of that variable. When the procedure exits, the variable is destroyed. These variables are called local variables. You can have local variables with the same name in different procedures, because each is recognized only by the procedure in which it is declared. If you declare a variable outside a procedure, all the procedures in your script will recognize it. These variables exists from the time they are declared until the time the script is finished running. |