Have a look at the VBA help on the ActionControl property. You can use the
property to change the Caption (name) or the FaceID of the control when it is
clicked.
Example:
You want your button to switch between the captions €śMyControl On€ť and
€śMyControl Off€ť.
You can obtain this by inserting e.g. the following code in the procedure
that that runs when you click the button:
With CommandBars.ActionControl
If .Caption = "MyControl On" Then
.Caption = "MyControl Off"
Else
.Caption = "MyControl On"
End If
End With
--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
"DerbyDad03" wrote:
I would like to change, via VBA, either the FaceID and/or the name on
a custom button that I have assigned to a macro.
Specifically, I want to be able click a specific button, have the code
run, and have the name and/or FaceID of *that* button change. It is
essentially a toggle button for an option and I want the FaceID or
name to tell me the current setting of that option.
The button exists and the toggle code runs fine, but I don't know how
to tell VBA which button I want to change.
Can I capture the control number of the button that was pressed via
code or do I have to know it's number beforehand? In either case, how
do I do it?
Thanks!