Hey fellow coders,
i am having a problem concerning my UserForm. I don't know what to do.
In my main module I have a procedure that does different things. It should react accordingly to which button is clicked on the userform.
What I have:
I have my userform with two buttons and the following code:
Code:
Private Sub UserForm_Initialize()
Dim iAnswer, iA, iB As Integer
End Sub
Private Sub CommandButtonA_Click()
iAnswer = iA
Unload Me
End Sub
Private Sub CommandButtonB_Click()
iAnswer = iB
Unload Me
End Sub
And I have a module with loads of subprocedures. One of them looks like that:
Code:
Sub main()
Dim iAnswer, iA, iB As Integer
(... code ....)
If CheckUp.Installed Then
UserForm1.Show vbModeless
End If
If iAnswer = iA Then
"do this and that"
ElseIf iAnswer = iB Then
"do this and that"
Else
"do that"
End If
End Sub
Problem:
The Macro doesn't react to which button is clicked. It just proceeds the first if-case. I guess this is because the variables from the UserForm don't get transported over to the module.
How can I solve that?
(Sorry if it is difficult to understand. English isn't my native language...)
Thank you so much!
Justice