Static and Dim outside procedure
augustus,
<From Help, Search="Static"
Static Statement
Used at procedure level to declare variables and allocate storage space.
Variables declared with the Static statement retain their values as long as
the code is running.
Syntax
Static varname[([subscripts])] [As [New] type] [, varname[([subscripts])]
[As [New] type]] . .
</From Help
<From Help, Search="Scope"
Understanding Scope and Visibility
Scope refers to the availability of a variable, constant, or procedure for
use by another procedure. There are three scoping levels: procedure-level,
private module-level, and public module-level.
You determine the scope of a variable when you declare it. It's a good idea
to declare all variables explicitly to avoid naming-conflict errors between
variables with different scopes.
</From Help
NickHK
"augustus" wrote in message
...
Hi,
Could someone please tell me what's the different between Static statement
and Dim variables with Public and at module level?
Because I find that both way retain value.
Thanks
Regards
Augustus
|