Two ToggleButton controls named ToggleButton1 and ToggleButton2.
Private Sub UserForm_Initialize()
TextBox1.EnterKeyBehavior = True
ToggleButton1.Caption = "EnterKeyBehavior is True"
ToggleButton1.Width = 70
ToggleButton1.Value = True
TextBox1.MultiLine = True
ToggleButton2.Caption = "MultiLine is True"
ToggleButton2.Width = 70
ToggleButton2.Value = True
TextBox1.Height = 100
TextBox1.WordWrap = True
TextBox1.Text = "Type your text here. If EnterKeyBehavior is True,"& _
" press ENTER to start a new line. Otherwise, press SHIFT+ENTER."
End Sub
Private Sub ToggleButton1_Click()
If ToggleButton1.Value = True Then
TextBox1.EnterKeyBehavior = True
ToggleButton1.Caption = "EnterKeyBehavior is True"
Else
TextBox1.EnterKeyBehavior = False
ToggleButton1.Caption = "EnterKeyBehavior is False"
End If
End Sub
Private Sub ToggleButton2_Click()
If ToggleButton2.Value = True Then
TextBox1.MultiLine = True
ToggleButton2.Caption = "MultiLine TextBox"
Else
TextBox1.MultiLine = False
ToggleButton2.Caption = "Single-line TextBox"
End If
End Sub