Retrieve caller

J

Jon

I need to write a macro which is called when a form
checkbox is checked (or unchecked) and determines what the
name of the checkbox is that triggered the macro.

For example, if the user checks Checkbox1, the macro needs
to be able to load that name into a variable.

Is anyone aware of how I could do this, or more
importantly does anyone have a code example that would
work for this?

-Thanks much,
Jon
 
G

Guest

I don't understand. I will admit I'm not a full-time
programmer and just write a little when needed around the
office. How could a change event figure out which checkbox
triggered the macro and thus capture it's name? The macro
is triggered 'upon entry' in it's properties which starts
the macro. I need to be able to get that checkbox name
which caused the macro to run.

-thanks, Jon
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < (e-mail address removed) > écrivait :

|| I don't understand. I will admit I'm not a full-time
|| programmer and just write a little when needed around the
|| office. How could a change event figure out which checkbox
|| triggered the macro and thus capture it's name? The macro
|| is triggered 'upon entry' in it's properties which starts
|| the macro. I need to be able to get that checkbox name
|| which caused the macro to run.
||
|| -thanks, Jon

Try the following code to get you going.
By the way, if you want to do something based on the checkbox state as set
by the user, it would be better to use the On Exit property so as to get the
information based on what the user did in the checkbox, not how it is before
the user does anything, which is what you would get with the On Entry call.

'_______________________________________
Sub GetName()

Dim CheckName As String

With Selection
CheckName = .FormFields(1).Name
MsgBox CheckName
End With

End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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