Giving checkboxes a value.

S

Samedy

Hello. I think I am writing in the right forum.

I am trying to make a Rubric form for a class. I am marking on a 5 point
system, where 5 areas are going to be marked (total 25 points).

What I want to do is put check boxes under each value and then have a total
box that would calculate the value of each box checked. Is this possible?
 
D

Doug Robbins - Word MVP on news.microsoft.com

If you are using formfields as in an protected document and the checkboxes
have the bookmark names Check1, Check2, ... Check24, Check25, and the
formfield where you want the result to be displayed has the bookmark name of
score, then if you run a macro containing the following code on exit from
each of the checkboxes, the score will be entered into the formfield with
the bookmark name of score:

Dim ff As FormField
Dim score As Long
score = 0
For Each ff In ActiveDocument.FormFields
If Left(ff.Name, 5) = "Check" Then
score = score + ff.result 'ff.result = 1 if the checkbox is checked
End If
Next
ActiveDocument.FormFields("Score").result = score


--
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, originally posted via msnews.microsoft.com
 

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