Catch all MS Word VBA Checkbox Events

Is it possible to catch all checkbox events ?
e.g. (note: Document_ContentControlOnClick doesn't exist as far as I'm aware)
Private Sub Document_ContentControlOnClick(ByVal ContentControl As ContentControl)
    If TypeOf ContentControl Is CheckBox Then
        MsgBox (ContentControl.Checked)
    End If
End Sub

Open in new window

ag1iffitAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
I guess you could emulate it with then OnEnter and OnExit events:

Option Explicit
Dim bChecked As Boolean

Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)
   If TypeOf ContentControl Is CheckBox Then
        bChecked = ContentControl.Checked
    End If

End Sub

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
   If TypeOf ContentControl Is CheckBox Then
        If bChecked <> ContentControl.Checked Then
             CBClicked ContentControl
        End If
    End If
End Sub

Private Sub CBClicked(ByVal ContentControl As ContentControl)
    MsgBox ContentControl.Checked
End Sub

Open in new window

0
OnisanCoder / ProgrammerCommented:
Yes you can
You need a small amount of code in a class module to capture it
So attached is an example
checkboxClass.doc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ag1iffitAuthor Commented:
Thanks, though for some reason this isn't having the effect I expected.

I added the code and break points, but the break points are not being hit (is that to be expected?)

I then added an existing check box click sub and then the OnEnter/Exit events both through an error : Screenshot-2015-04-01-13.37.47.png
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

OnisanCoder / ProgrammerCommented:
does the document I have given you work?
0
ag1iffitAuthor Commented:
Question 100% answered with a concise working example.
Doesn't get better. 10,000 points.
0
OnisanCoder / ProgrammerCommented:
Thank you very much :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.