Inserting text from checkboxes
Hello,
Is there another way to write the codes I have below?
The idea is to insert the text shown in the text box including "and" if there are multiple entries.
If Me.Chbx2 = True And Me.Chbx3 = True And Me.Chbx4 = True And Me.Chbx5 = True And Me.Chbx6 = True Then
Selection.GoTo What:=wdGoToBookmark, Name:="First"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = True
End With
Selection.TypeText Text:=" CheckBox2, "
Selection.TypeText Text:="CheckBox3, CheckBox4, CheckBox5 and CheckBox6"
OR if the below is my selection
If Me.Chbx2 = True And Me.Chbx3 = False And Me.Chbx4 = True And Me.Chbx5 = And Me.Chbx6 = True Then
Selection.GoTo What:=wdGoToBookmark, Name:="First"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = True
End With
Selection.TypeText Text:=" CheckBox2, CheckBox4 and CheckBox6"
Thanks in advance.
|