using check box values in a formula

P

Paula- Horsemom

I have a simple word form with various formfield controls. I want to use a
formula field that counts the number of boxes which are checked (there are
only 5). I was thinking I could use an if or something, but I'm not clear
on how to get the state of the check box. I'm using the default bookmark
names (check1)


for examle If check1 is checked, then add 1 to cnt, if check2 is checked
then add 1 to cnt. Or something liek that.

I was hoping to keep this simple and not need to write a macro.

Thanks.
 
D

Doug Robbins - Word MVP

You need to use the .Checkbox.Value attribute of the formfield to determine
whether or not it is checked;

Dim Counter As Long
Counter = 0
With ActiveDocument
If .FormFields("Check1").CheckBox.Value = True Then Counter = Counter +
1
If .FormFields("Check2").CheckBox.Value = True Then Counter = Counter +
1
If .FormFields("Check3").CheckBox.Value = True Then Counter = Counter +
1
If .FormFields("Check4").CheckBox.Value = True Then Counter = Counter +
1
If .FormFields("Check5").CheckBox.Value = True Then Counter = Counter +
1
End With
MsgBox Counter



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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