Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 563
- Office Version
- 365
- 2010
- Platform
- Windows
On my userform, I have 16 checkboxes. Some of these checkboxes enable textboxes like the code below shows.
The error code in the title occurs on this line of code:
What I am wanting to happen is if the user clicks on a checkbox that has a textbox I want the checkbox caption to display followed by a " - " and the textbox caption. Below is the code.
Thak you
Code:
Private Sub chkbxAlignment_Click()
If Me.chkbxAlignment.Value = True Then
Me.txtbxAlignment.Enabled = True
Me.txtbxAlignment.SetFocus
Else
Me.txtbxAlignment.Value = ""
Me.txtbxAlignment.Enabled = False
End If
End Sub
The error code in the title occurs on this line of code:
Code:
If "TextBox" Like "*" & TypeName(cf) & "*" Then If cf.Value Then s = s & cf.Caption & ", "
What I am wanting to happen is if the user clicks on a checkbox that has a textbox I want the checkbox caption to display followed by a " - " and the textbox caption. Below is the code.
VBA Code:
Case Is = "Frame2"
For Each cf In ctrl.Controls
If "CheckBox" Like "*" & TypeName(cf) & "*" Then If cf.Value Then s = s & cf.Caption & ", "
If "TextBox" Like "*" & TypeName(cf) & "*" Then If cf.Value Then s = s & cf.Caption & ", "
Next
Thak you