View Single Post
 
Old 04-14-2022, 11:38 AM
Italophile Italophile is offline Windows 11 Office 2021
Expert
 
Join Date: Mar 2022
Posts: 554
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

There are tools available in the Visual Basic Editor to help you answer questions like this: IntelliSense, the Object Browser, online help.

Code:
Sub ResetCCs()
    Dim aCC As ContentControl, iType As Integer
    Dim bbCat As String, bbType As Long
    For Each aCC In ActiveDocument.ContentControls
        With aCC
            Select Case .Type
                Case wdContentControlText, wdContentControlRichText, wdContentControlDate
                    .Range.Text = ""
                Case wdContentControlComboBox, wdContentControlDropdownList
                    .DropdownListEntries(1).Select
                Case wdContentControlCheckBox
                    .Checked = False
                Case wdContentControlBuildingBlockGallery
                    iType = .Type
                    bbType = .BuildingBlockType
                    bbCat = .BuildingBlockCategory
                    .Type = wdContentControlRichText
                    .Range.Text = ""
                    Do While .Range.Tables.Count > 0
                        .Range.Tables(1).Delete
                    Loop
                    .Type = iType
                    .BuildingBlockType = bbType
                    .BuildingBlockCategory = bbCat
            End Select
        End With
    Next aCC
End Sub
Attached Images
File Type: png IntelliSense.png (6.7 KB, 14 views)
File Type: png Object Browser.png (77.2 KB, 14 views)
Reply With Quote