![]() |
#1
|
|||
|
|||
![]()
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 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 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 |
Tags |
userform |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Array to iterate through variables and trap blank variables | Marrick13 | Word VBA | 5 | 08-04-2015 06:19 AM |
can word: make variables, find appropriate pages, fill out pages with variables, print only those | 20GT | Word VBA | 1 | 10-15-2014 09:48 PM |
VBA Code in a UserForm module to delete a Command Button which opens the userform | Simoninparis | Word VBA | 2 | 09-21-2014 03:50 AM |
![]() |
leemoreau | Word VBA | 1 | 09-14-2013 06:01 AM |
AZWizard Module - ?hidden module | pcaldwell | Word | 1 | 08-22-2012 01:19 PM |