I have been working with a protected form and have been asked to add a table
to the form which has 5 columns. The first column is a description of an
item and columns B, C, D and E contain check boxes. The last row of the
table is supposed to give the total number of "true" check boxes for each
column. Frankly, I don't have a clue if this is possible. Any and all
assistance would be appreciated.

Sjane

Re: Formula to Determine Number of Checked Check Boxes in Table Column by Helmut

Helmut
Mon Sep 15 18:27:44 CDT 2003

Hi sjane,
shure it is possible, but there a many ways.
First thing I would do is to give all the checkboxes
systematically names (RxCy). Like that for a first empty
table with 4 columns and 9 rows:
Dim r As Integer
Dim c As Integer
Dim s As String
Dim f As Integer
f = 0
With ActiveDocument.Tables(1)
For r = 1 To 9
For c = 1 To 4
f = f + 1
.Cell(r, c).Select
Selection.Collapse
Selection.FormFields.Add _
Range:=Selection.Range, _
Type:=wdFieldFormCheckBox
ActiveDocument.FormFields(f).Select
s = "R" & Trim(Str(r))
s = s & "C" & Trim(Str(c))
ActiveDocument.FormFields(f).Name = s
ActiveDocument.FormFields(f).CheckBox.Value = False
Next
Next
Once You got a system, it's easy.
Dim oFr As formfield
Dim i as integer
For Each oFr In ActiveDocument.FormFields
if left(oFr.name, 2) = "C2" then ' column 2
i = i + ofr.result
end if
Next
Msgbox i ' sum of checked boxes in column 2.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT4.0





Re: Formula to Determine Number of Checked Check Boxes in Table Column by Helmut

Helmut
Mon Sep 15 18:36:06 CDT 2003

Note: This is a hint into the hopefully right direction,
not a ready to use solution. E.G. it does not provide
for documents containing various tables with merged
and split cells and nested tables or whatever.
HW


Re: Formula to Determine Number of Checked Check Boxes in Table Column by sjane

sjane
Tue Sep 16 07:34:05 CDT 2003

Helmut - sincerest thanks. I think I get the concept. Rather than a
message box with the total, I need a total to appear in the last cell of
each column in order that the number will show up when the document is
printed. Is there a better approach to doing that? Thanks again.

Sjane

"Helmut Weber" <h.weber@nospam.de> wrote in message
news:0ee901c37be0$f75a0af0$a001280a@phx.gbl...
> Hi sjane,
> shure it is possible, but there a many ways.
> First thing I would do is to give all the checkboxes
> systematically names (RxCy). Like that for a first empty
> table with 4 columns and 9 rows:
> Dim r As Integer
> Dim c As Integer
> Dim s As String
> Dim f As Integer
> f = 0
> With ActiveDocument.Tables(1)
> For r = 1 To 9
> For c = 1 To 4
> f = f + 1
> .Cell(r, c).Select
> Selection.Collapse
> Selection.FormFields.Add _
> Range:=Selection.Range, _
> Type:=wdFieldFormCheckBox
> ActiveDocument.FormFields(f).Select
> s = "R" & Trim(Str(r))
> s = s & "C" & Trim(Str(c))
> ActiveDocument.FormFields(f).Name = s
> ActiveDocument.FormFields(f).CheckBox.Value = False
> Next
> Next
> Once You got a system, it's easy.
> Dim oFr As formfield
> Dim i as integer
> For Each oFr In ActiveDocument.FormFields
> if left(oFr.name, 2) = "C2" then ' column 2
> i = i + ofr.result
> end if
> Next
> Msgbox i ' sum of checked boxes in column 2.
> Greetings from Bavaria, Germany
> Helmut Weber
> "red.sys" & chr$(64) & "t-online.de"
> Word 97, NT4.0
>
>
>
>