Hi all,
I have a form that uses option buttons to store parameters. I need to access these parameters as variables from a module then pass them to a procedure. Problem is that I lose the variable when UserForm1 gets unloaded. I have declared the variable as Public but nothing. Can someone shed some light?
Thanks.
-B
Heres an example:
I have a form that uses option buttons to store parameters. I need to access these parameters as variables from a module then pass them to a procedure. Problem is that I lose the variable when UserForm1 gets unloaded. I have declared the variable as Public but nothing. Can someone shed some light?
Thanks.
-B
Heres an example:
Code:
'UserForm1
Option Explicit
Public myOption As String 'Need to pass this to Module1
Private Sub cmdSubmit_Click()
'MsgBox myOption
Unload Me
End Sub
Private Sub optButton1_Click()
myOption = "1"
End Sub
Private Sub optButton2_Click()
myOption = "2"
End Sub
'Module1
Option Explicit
Public myOption As String
Sub Option_Test()
MsgBox myOption 'No variable, MsgBox is blank
End Sub