如何将用户表单列表框中的选择填充到项目符号中?

How To Populate Selections From A User Form List Box into Bullets?

以下代码采用列表框中所选文本的任意组合并添加一个项目符号,如图所示:

Dim SelectedTexts As String
Dim index As Long

    For index = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(index) Then
         
            SelectedTexts = SelectedTexts & ListBox1.List(index) & " "
        End If
    Next
        Selection.Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:= _
        ListGalleries(wdBulletGallery).ListTemplates(1), ContinuePreviousList:= _
        False, ApplyTo:=wdListApplyToWholeList, DefaultListBehavior:= _
        wdWord10ListBehavior

    ActiveDocument.SelectContentControlsByTitle("Test").Item(1) _
    .Range.Text = SelectedTexts
Unload Me

lbl_Exit:
  Exit Sub
Me.Repaint
Me.Hide

问题:如何从如下所示的列表框中填充所选文本?

应该这样做:

Dim SelectedTexts As String
Dim index As Long

    For index = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(index) Then
            If SelectedTexts = "" Then
                SelectedTexts = ListBox1.List(index)
            Else
                SelectedTexts = SelectedTexts & vbNewLine & ListBox1.List(index)
            End If
        End If
    Next
        Selection.Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:= _
        ListGalleries(wdBulletGallery).ListTemplates(1), ContinuePreviousList:= _
        False, ApplyTo:=wdListApplyToWholeList, DefaultListBehavior:= _
        wdWord10ListBehavior

    ActiveDocument.SelectContentControlsByTitle("Test").Item(1) _
    .Range.Text = SelectedTexts
Unload Me

lbl_Exit:
  Exit Sub
Me.Repaint
Me.Hide