R
RyanH
I am getting a 'Type Mismatch Error' when I use the Set Statement in a
control of my Userform. I want to change the Enabled and BackColor
properties of certain Controls on the Userform when the Illumination ComboBox
equals certain values. I have an Array of all the Controls Names. Why am I
getting this error?
Private Sub cboIllumination_Change()
Set Fluorescents = Controls(Array("tbxBallasts", "cboBallasts",
"cboLamps1", _
"cboLamps2", "tbxLamps1",
"tbxLamps2", _
"cboOrientation1", "cboOrientation2"))
Set LEDs = Controls(Array("tbxTransformers", "cboSpacing", "tbxLEDs"))
Select Case cboIllumination
Case "Single Row T12 HO Fluorescent"
For Each Control In Fluorescents
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmLEDs.Controls
Control.Enabled = False
Next Control
For Each Control In LEDs
Control.BackColor = vbButtonFace
Next Control
Case "Single Row T8 HO Fluorescent"
For Each Control In Fluorescents
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmLEDs.Controls
Control.Enabled = False
Next Control
For Each Control In LEDs
Control.BackColor = vbButtonFace
Next Control
Case "LEDs"
For Each Control In LEDs
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmFluorescents.Controls
Control.Enabled = False
Next Control
For Each Control In Fluorescents
Control.BackColor = vbButtonFace
Next Control
End Select
'disables Estimate command button if no illumination, and visa versa
If cboIllumination = "No Illumination" Then
cmbEstimate.Enabled = False
Else
cmbEstimate.Enabled = True
End If
End Sub
Thanks in Advance,
Ryan
control of my Userform. I want to change the Enabled and BackColor
properties of certain Controls on the Userform when the Illumination ComboBox
equals certain values. I have an Array of all the Controls Names. Why am I
getting this error?
Private Sub cboIllumination_Change()
Set Fluorescents = Controls(Array("tbxBallasts", "cboBallasts",
"cboLamps1", _
"cboLamps2", "tbxLamps1",
"tbxLamps2", _
"cboOrientation1", "cboOrientation2"))
Set LEDs = Controls(Array("tbxTransformers", "cboSpacing", "tbxLEDs"))
Select Case cboIllumination
Case "Single Row T12 HO Fluorescent"
For Each Control In Fluorescents
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmLEDs.Controls
Control.Enabled = False
Next Control
For Each Control In LEDs
Control.BackColor = vbButtonFace
Next Control
Case "Single Row T8 HO Fluorescent"
For Each Control In Fluorescents
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmLEDs.Controls
Control.Enabled = False
Next Control
For Each Control In LEDs
Control.BackColor = vbButtonFace
Next Control
Case "LEDs"
For Each Control In LEDs
Control.BackColor = vbWindowBackground
Next Control
For Each Control In frmFluorescents.Controls
Control.Enabled = False
Next Control
For Each Control In Fluorescents
Control.BackColor = vbButtonFace
Next Control
End Select
'disables Estimate command button if no illumination, and visa versa
If cboIllumination = "No Illumination" Then
cmbEstimate.Enabled = False
Else
cmbEstimate.Enabled = True
End If
End Sub
Thanks in Advance,
Ryan