locked
Insert Word Headings in ListBox including numbers with VBA RRS feed

  • Question

  • Currently I use VBA to create headlines at a certain level. For this I use the following code:
    Private Sub InsertButton_Click()
    
    'Insert Title
    With Word.Selection
    .TypeText Text:=FeatureBox.Text & " " & "-" & " " & ComponentBox.Text & " " & "-" & " " & TitleBox.Text
    .Font.size = 12
    .Font name = "Calibri"
    .Font.Bold = True
    .style = wdStyleHeading3
    .type paragraph
    
    End With
    
    End Sub

    I would like to automatically insert each heading on level 3 into a Multicolumn ListBox. Copying the text is less of a problem, but I would like to insert the automatically generated heading number into the ListBox as well. As an additional function I would like to jump to the element selected in the ListBox by double clicking.

    Is this even possible? I would be very grateful for your help.

    Many thanks and best regards

    Ben


    • Edited by bsch09 Thursday, September 3, 2020 8:17 AM
    Thursday, September 3, 2020 8:02 AM