Thanks Graham,
I can see what the macro does but how do I actually make the "macro
run on exit from the last of the check box fields" ?
//Anders
:
If you ensure that the checkbox bookmarks are all named the same
with the addition of incrementing numbers (here I have used the
default names Check1, Check2 through to Check 5) then the
following macro run on exit from the last of the check box fields
will insert the total number from 5 checked fields in a form field
with the bookmark named Text1
Sub CountChecks()
Dim i As Long
Dim Count As Long
Dim cFields As Integer
Dim cName As String
Dim tName As String
cName = "Check" ' set to common name of check box fields
cFields = 5 'set to the number of check boxes
tName = "Text1" ' name of text box field used _
for the result
Count = 0
For i = 1 To cFields
If ActiveDocument.FormFields(cName & i).CheckBox.Value =
True Then Count = Count + 1
End If
Next i
ActiveDocument.FormFields(tName).Result = Count
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
A_________ wrote:
Word2007
Checkbox is a FormField inserted from developer>controls>earlier
tools>checkbox(formfield) --- [I hope that is correct, I
translated it into English from Swedish version's
utvecklare>kontroller>tidigare
verktyg>kryssruta(formulärkontroll)]
:
Hi =?Utf-8?B?QV9fX19fX19fXw==?=,
I have a series af check boxes in a MS Word document. I want to
(automatically)display the number of check boxes that are
checked. The number as plain text at the end of the document
would do.
Version of Word?
What kind of checkboxes are these (which toolbar did you use to
insert them)?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17
2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail