Message 1 of 6
Defining a Globally available Variable
Not applicable
07-28-2005
03:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I do not understand what is so different between VBA and VB 6, but I was
able to, in VB 6 to define a global variable by:
Public 'Variable' As 'Type'
This variable was defined like this in a Module (to keep things cleaner), if
I do the same thing with VBA, the variable does not transfer between the
dialogs.
I define this variable in the class as above (it is an integer), in one
dialog, I set its value from a text box in one dialog (call this one dlg2)
(this dialog is started via a button in another dialog - ill call it dlg1).
After filling out the text box and pressing the ok button on dlg2 (okay sets
the variable) a message box pops up displaying the value in the variable,
the dlg2 closes. Back in dlg1, another message box appears, the value for
the variable is now 0.
Just wondering if somebody out there could tell me what I am doing wrong in
defining a variable that has the ability to pass between dialogs?
Thank you
I do not understand what is so different between VBA and VB 6, but I was
able to, in VB 6 to define a global variable by:
Public 'Variable' As 'Type'
This variable was defined like this in a Module (to keep things cleaner), if
I do the same thing with VBA, the variable does not transfer between the
dialogs.
I define this variable in the class as above (it is an integer), in one
dialog, I set its value from a text box in one dialog (call this one dlg2)
(this dialog is started via a button in another dialog - ill call it dlg1).
After filling out the text box and pressing the ok button on dlg2 (okay sets
the variable) a message box pops up displaying the value in the variable,
the dlg2 closes. Back in dlg1, another message box appears, the value for
the variable is now 0.
Just wondering if somebody out there could tell me what I am doing wrong in
defining a variable that has the ability to pass between dialogs?
Thank you