You can also have a variable with the same name at a different scope. For example, you could have a public variable named Temp and then, within a procedure, declare a local variable named Temp. References to the name Temp within the procedure would access the local variable; references to Temp outside the procedure would access the public variable. The module-level variable can be accessed from within the procedure by qualifying the variable with the module name.Public Temp As Integer
In general, when variables have the same name but different scope, the more local variable always shadows (that is, it is accessed in preference to) less local variables. So if you also had a procedure-level variable named Temp, it would shadow the public variable Temp within that module.
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/11411056/viewspace-734288/，如需转载，请注明出处，否则将追究法律责任。