Word Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We are using Word forms for evaluations and have a series of check boxes. I need to add up the number of "checked" boxes in a specific column. Any ideas how I can do this?
 
Kris,

The following supports counting the number of checked
boxes in column 2 of a table with a header row (excluded)
and the second to last row leaving the last row for the
result.

Sub TallyColumnOfCheckboxes()
'Macro counts number of formfield checked boxes located
between rows 1 and total rows - 1, in the second column.
Modify to suit.
Dim Total As Integer, i As Integer
Total = 0
'i represents a counter for each row in the table. We
start at 2
'skipping the heading row and we stop at the second to
last row or
'Count -1 to leave space for the total.
For i = 2 To ActiveDocument.Tables(1).Rows.Count - 1
'A checked box returns a value of negative 1 or -1,
Therefore each
'checked box results in the Total incrementing by 1.
'Consider 0 - (-1) = 1
Total = Total - ActiveDocument.Tables(1).Cell(i,
2).Range. _
FormFields(1).CheckBox.Value
Next i
'The result is displayed in the formfield
bookmarked "Total"
ActiveDocument.FormFields("Total").Result = Total

End Sub



-----Original Message-----
We are using Word forms for evaluations and have a series
of check boxes. I need to add up the number of "checked"
boxes in a specific column. Any ideas how I can do this?
 
Back
Top