What is the difference between:
Global variable As Boolean
Dim variable As Boolean
What is the difference between:
Global variable As Boolean
Dim variable As Boolean
It's all to do with variable visibility
Dim X as Boolean
means that X only is visible in the module in which its declared. It would be OK to have a different variable X in another module and the code would not get confused.
Public X as Boolean
means that X is visible across all modules and can be used in any.
Martin
What is the difference between:
Global variable As Boolean
Dim variable As Boolean
A variable can be "global" in 2 ways: (1) if it is accessible by all codes in a module or (2) if it is accessible by all codes in a project (across all modules).
Both are accomplished by declaring the variable at the TOP of the module before the first Sub - in the case of the Ist with a DIM statement and for the 2nd with a PUBLIC statement.
Last edited by Myles; 10-08-2006 at 07:26 AM.
HTH
Myles
...constantly looking for the smoother pebble while the whole ocean of truth lies before me.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks