Sometimes, however, you want to use a variable with a broader scope, one whose value is available to all procedures within the same module, or even to all the procedures in all modules. With Visual Basic, you can specify the scope of a variable when you declare it. Variables are private to the procedure in which they appear. You can't declare public variables within a procedure. Module-level Variables are private to the module in which they appear.
Variables are available to all modules.
Top Variables Used Within a Procedure Procedure-level variables are recognized only in the procedure in which they're declared. These are also known as local variables. Dim intTemp As Integer Static intPermanent As Integer Local variables declared with the Dim keyword exist only as long as the procedure is running. Local variables declared with the Static keyword exist the entire time your application is running. Because of the advantages they provide, consider using local variables for any kind of temporary calculation.