Variable question

I understand that a variable only is seen within a Method, and that if I need a variable that can be seen in all methods I should make it a property. However a property still is only seen within the Window where it is placed. How can I make a variable that can be seen on all Windows?

Putting it in a module makes it globally available.

1 Like

Thanks! That’s why it looks like a globe :slight_smile:

1 Like

Do not forget the scope (for variables declared in Modules):

Also, a variable declared in a block exists only in that block:

If foo Then
Dim fam As Integer // Exist only here
// other code
End If

You can check that by yourself in putting a break before, inside and after the If block and watch for fam in the debugger…

1 Like