Populate a table based on check box status

Joined
Jan 2, 2020
Messages
16
Reaction score
0
Hi folks,

In the attached document you'll see a table at the top to track the status of several questions. Below that are some blank sample questions and each has a check box at the end to represent whether the response to the question is complete.

My users would like the "Status" column of the table at the top to automatically say "Complete" if the corresponding check box is checked and "Incomplete" if the box is not checked. Is there a way to do that? They're OK with using Controls to accomplish this if that's the right way to do it.

Thanks in advance for any help you can provide.

Beej
 

Attachments

  • Nonclinical Response Document.docx
    27.7 KB · Views: 126

macropod

Microsoft MVP
Joined
Mar 2, 2012
Messages
578
Reaction score
50
You could use a macro in the document's 'ThisDocument' code module like:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Dim StrOut As String
With CCtrl
  If .Title Like "Question#" Then
    If .Type = wdContentControlCheckBox Then
      Select Case .Checked
        Case True: StrOut = "Complete"
        Case False: StrOut = "Incomplete"
      End Select
      ActiveDocument.Tables(1).Cell(Split(.Title, "Question")(1) + 1, 4).Range.Text = StrOut
    End If
  End If

End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top