#1
|
|||
|
|||
Macro command to count checkboxes and provide metrics
I have set up the developer option in the ribbon and seem to be using ActiveX controls
Five total columns that are all strings of data with the checkbox as column 1. Do have an overview that starts the table for about three rows or so. Would like to be able to show certain metrics in that area at the top of document Number of total checkboxes + checkboxes checked Percentage of checked / unchecked Am I able to export results to text document? Is it possible to have multiple word document results all be stored in one master results list? Any insight or information would be much appreciated Below was probably best results of info when researching: Quote:
|
#2
|
||||
|
||||
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 Tools | |
Display Modes | |
|
Similar Threads | ||||
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 |