View Single Post
 
Old 04-13-2022, 07:45 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Try this version
Code:
Sub ResetCCs()
  Dim aCC As ContentControl, iType As Integer
  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
          .Type = wdContentControlRichText
          .Range.Text = ""
          Do While .Range.Tables.Count > 0
            .Range.Tables(1).Delete
          Loop
          .Type = iType
      End Select
    End With
  Next aCC
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia

Last edited by Guessed; 04-13-2022 at 11:30 PM. Reason: Amended to deal with tables in Building Block CCs
Reply With Quote