I want to use a variable over different frames. Can anyone tell me how to create the variable and how to fill it in another frame?
Printable View
I want to use a variable over different frames. Can anyone tell me how to create the variable and how to fill it in another frame?
I'm assuming you mean forms. Add a module and declare it there
There are several ways to do this:
-Dim: Use Dim in a procedure the dim the variable only for that procedure. Use Dim in the Declarations of a form to dim it for the whole form.
-Public: Use Public in the declarations of your form or module to dim it for your whole project.
Example:
I hope this helped youCode:Option Explicit
Dim MyVar As String 'Only for this form or module
Public MyVar As String 'For the whole project :)
WP
You can even declare your functions and subs as Public in a Form. So you can call them also in any form or module...