G
Geoff Edwards
Previously you were very helpful when I was writing a procedure to set
the background colours of some controls.
We ended up with a procedure thus:
Public Sub SetBackgroundColours(frm As MSForms.UserForm)
(Do the stuff)
End Sub
I am now doing something similar (I don't think I need to bore you
with the details) which requires me to keep track of certain controls
in a form by building a list, and I need to check which form was last
worked over (to avoid repeating the process.
I have:
Public CurrentForm as MSForms.UserForm
Public Sub GetControls (frm as MSForms.UserForm)
If CurrentForm <> frm then
Get_A_List_Of_Controls_I_Want_From_frm
set CurrentForm = frm
End if
Colour_The_Controls_In_The_List
End Sub
When I try to compile this I get "Type Mismatch" on the line
If CurrentForm <> frm
I have tried several settings - Form, UserForm, MSForms.UserForm
(always making sure that CurrentForm and frm have the same definition)
without success.
What is the correct way to do this? I am obviously referencing the
form OK because it works in SetBackgroundColours. My problem is the
correct way of storing the value of the last frm examined.
TIA
Geoff Edwards
Leeds, UK
e-mail: (e-mail address removed)
(replace the stopspambot bit with some
version of my name)
the background colours of some controls.
We ended up with a procedure thus:
Public Sub SetBackgroundColours(frm As MSForms.UserForm)
(Do the stuff)
End Sub
I am now doing something similar (I don't think I need to bore you
with the details) which requires me to keep track of certain controls
in a form by building a list, and I need to check which form was last
worked over (to avoid repeating the process.
I have:
Public CurrentForm as MSForms.UserForm
Public Sub GetControls (frm as MSForms.UserForm)
If CurrentForm <> frm then
Get_A_List_Of_Controls_I_Want_From_frm
set CurrentForm = frm
End if
Colour_The_Controls_In_The_List
End Sub
When I try to compile this I get "Type Mismatch" on the line
If CurrentForm <> frm
I have tried several settings - Form, UserForm, MSForms.UserForm
(always making sure that CurrentForm and frm have the same definition)
without success.
What is the correct way to do this? I am obviously referencing the
form OK because it works in SetBackgroundColours. My problem is the
correct way of storing the value of the last frm examined.
TIA
Geoff Edwards
Leeds, UK
e-mail: (e-mail address removed)
(replace the stopspambot bit with some
version of my name)