• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

What Is Scope?

Scope refers to the range, reach, extent, or sphere of availability of a variable, constant, or procedure to other procedures. A variable, constant, or procedure can be declared public or private. If they are declared with Public scope, they are available to all procedures in all modules in all applications unless Option Private Module is in effect; in which case, they are available only within the project in which they reside. Anything that is declared with Private scope is available only within the module in which it was declared.

NOTE

Any variable declared as private in the declarations section of the module is available to any procedure in the module. If a variable is not in the declaration section (in other words, it is declared within the procedure), it is available only to the procedure itself. The declaration section is at the top of a standard module, before any procedures have been declared. Just to be sure, select declarations from the upper-right drop-down box of the procedure to go there. The Dim statement is functionally like the Private statement, but the Private keyword makes the intentions more obvious.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint