I have a Form UserForm1 having two command buttons command 1 and command 2. The variable var = 1 when command1 is pressed and var=2 if command 2 is pressed. Var is a global variable in UserForm1. expDate and textRecDate are two textboxes in UserForm1
I have a class module clsMod and I am trying to do something like this
If UserForm1.var= 1 Then
UserForm1.expDate.Text = SelectedDate
If UserForm1.var= 2 Then
UserForm1.textRecDate.Text = SelectedDate
I want to extend the scope of var to the class module. Is there a way I can do that.
thanks
You don’t really want to “extend” the scope – you want to restrict the scope to the Form level and then use
Publicmethods to access/control the form.eg – In UserForm1…
And in clsMod..
etc etc
Oh and if the naming is not just for demonstration / example purposes please don’t get in the habit of calling your buttons
Command1andCommand2and your variablesVar😀 …