Hi, I have an existing script that retrieves all Content Controls from a Word Document and prints it into an Excel spreadsheet.

Currently it works for free text/rich text content control types but I need to extend this functionality to Checkbox types.

Ideally it will capture "True" or "False" depending whether the checkbox is ticked or not

Here is the existing code:

Sub ContentControlExtraction()
    ' VARIABLES FOR THIS WORKBOOK
    Dim DocWorkbook As Workbook
    Set DocWorkbook = Application.ActiveWorkbook
    Dim DocSheet As Worksheet
    Set DocSheet = DocWorkbook.ActiveSheet
    DocSheet.Cells(1, 1).Value = "Field Name"
    DocSheet.Cells(1, 2).Value = "Value"
    
    ' OPEN WORD DOCUMENT
    Dim WordApp As Word.Application
    Set WordApp = CreateObject("Word.Application")
    WordApp.Visible = True
    Dim WordDoc As Word.Document
    Set WordDoc = WordApp.Documents.Open(ThisWorkbook.Path & "\test.docx")
    
    Dim intNumContentControls As Integer
    intNumContentControls = WordDoc.ContentControls.Count
      
    ' LOOP FOR EACH CONTENT CONTROL
    Dim i As Integer
    For i = 1 To intNumContentControls
        DocSheet.Cells(i + 1, 1).Value = WordDoc.ContentControls(i).Title
        DocSheet.Cells(i + 1, 2).Value = WordDoc.ContentControls(i).Range.Text
    Next i
    
    Debug.Print "NUMBER OF CONTENT CONTROLS: " & intNumContentControls
        
End Sub
How would you modify this code to work with Checkbox content controls?

I.e. if it is free text/rich text, just capture as it is, if it is checkbox type, translate it to "True" or "False"

Also, sometimes the form I am capturing uses Wingdings Character 254 (a tickbox) for Checked, instead of the standard 'X' box. Do take this into account