Word Forms

K

KrisGS

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?
 
G

Greg

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?
 

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