L
Legacy 234612
Guest
I have created a userform in word via VBA code. I have several checkboxes I have grouped into different frames. I want a user to be able to select multiple checkboxes and have the captions returned next to one bookmark value separated by commas, but only one checkbox displays for me when I check them all. Can anyone tell me how to do this? I am new to vba code so really not sure how to accomplish this. I think maybe I need a string?
Private Sub CmbSubmit_Click()
Dim SSN As Range
Set SSN = ActiveDocument.Bookmarks("SSN").Range
SSN.Text = Me.TbxSSN.Value
Dim oCtrl As Control
Dim NeededForms As Range
Set NeededForms = ActiveDocument.Bookmarks("NeededForms").Range
For Each oCtrl In NeededForms1.Controls
If TypeName(oCtrl) = "CheckBox" Then
If oCtrl.Value = True Then
NeededForms.Text = oCtrl.Caption
Exit For
End If
End If
Next oCtrl
Unload Me
Repaint
End Sub
Private Sub CmbSubmit_Click()
Dim SSN As Range
Set SSN = ActiveDocument.Bookmarks("SSN").Range
SSN.Text = Me.TbxSSN.Value
Dim oCtrl As Control
Dim NeededForms As Range
Set NeededForms = ActiveDocument.Bookmarks("NeededForms").Range
For Each oCtrl In NeededForms1.Controls
If TypeName(oCtrl) = "CheckBox" Then
If oCtrl.Value = True Then
NeededForms.Text = oCtrl.Caption
Exit For
End If
End If
Next oCtrl
Unload Me
Repaint
End Sub