![]() |
|
#1
|
||||
|
||||
![]()
I think you should be using Content Controls for the checkboxes and the reporting fields.
This macro goes into the ThisDocument module Code:
Private Sub Document_ContentControlOnExit(ByVal thisCC As ContentControl, Cancel As Boolean) Dim aCC As ContentControl, iTotal As Integer, iChecked As Integer, dPercent As Double If thisCC.Type = wdContentControlCheckBox Then iTotal = ActiveDocument.SelectContentControlsByTag("Check").Count For Each aCC In ActiveDocument.SelectContentControlsByTag("Check") If aCC.Checked Then iChecked = iChecked + 1 Next aCC ActiveDocument.SelectContentControlsByTitle("Number Checked")(1).Range.Text = iChecked ActiveDocument.SelectContentControlsByTitle("Number Total")(1).Range.Text = iTotal ActiveDocument.SelectContentControlsByTitle("Percentage Checked")(1).Range.Text = Format(iChecked / iTotal, "0%") End If End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add / Sum checked Checkboxes labelled 1, 2, 3, etc. in Word Table - Need Macro? | klearazkrystal | Word VBA | 7 | 03-31-2019 11:50 PM |
Need Macro to select Checkbox after two boxes are checked in a series of checkboxes | rsaini | Word VBA | 0 | 01-16-2018 11:57 AM |
count selected checkboxes in each group | a888 | Word VBA | 8 | 02-24-2015 04:44 AM |
Ammunition count macro | Owastell | Excel Programming | 3 | 07-03-2014 11:00 AM |
Collecting Metrics in Project | TimJimO | Project | 0 | 12-29-2010 12:12 PM |