Scoping variables

A variable's scope determines which modules and procedures the variable can be used in. As you can read in Table 8-2, a variable's scope can be any of the following:

Table 8-2 VARIABLE SCOPE

Scope How a Variable with This Scope Is Declared

Single procedure Include a Dim or Static statement within the procedure.

Single module Include a Dim or Private statement before the first procedure in a module.

All modules Include a Public statement before the first procedure in a module.

I discuss each scope further in the following sections.

0 0

Post a comment