ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Names of macros for toolbar buttons (https://www.excelbanter.com/excel-programming/300540-names-macros-toolbar-buttons.html)

DredanZyl[_3_]

Names of macros for toolbar buttons
 
Where can I find the names of the macros for the buttons on the standar
or any other toolbar? I have written a macro which I would like t
assign to the 'Copy' button but I would like to be able to reverse i
if I run into problems

--
Message posted from http://www.ExcelForum.com


Greg Wilson[_4_]

Names of macros for toolbar buttons
 
These are built-in controls. They do not have VBA macros
assigned to them but instead have built-in functionality.
Excel supports assigning VBA macros to these controls in
the normal manner. To reverse this you can "Reset" either
the specific control or the entire tool bar.

To reset, for example, the Standard tool bar:
1) Right click the tool bar
2) Select Customize (bottom of list)
3) Select the Toolbars tab
4) Select the Standard tool bar from the list
5) Click the Reset button
Alternatvely, run the code:
Application.CommandBars("Standard").Reset

To reset a specific control, for example, the Copy control
on the Standard tool bar, run this code:
With Application.CommandBars("Standard")
.Controls("&Copy").Reset
End With

Regards,
Greg

-----Original Message-----
Where can I find the names of the macros for the buttons

on the standard
or any other toolbar? I have written a macro which I

would like to
assign to the 'Copy' button but I would like to be able

to reverse it
if I run into problems.


---
Message posted from http://www.ExcelForum.com/

.


Greg Wilson[_4_]

Names of macros for toolbar buttons
 
To those reading my post through DevDex, the website
automatically substituted the copyright symbol for the
name of the Copy control. It should read as the ampersand
symbol "&" immediately preceding the word "Copy". If I
join the two the website apparently will make the
substitution.

Regards,
Greg

-----Original Message-----
These are built-in controls. They do not have VBA macros
assigned to them but instead have built-in functionality.
Excel supports assigning VBA macros to these controls in
the normal manner. To reverse this you can "Reset" either
the specific control or the entire tool bar.

To reset, for example, the Standard tool bar:
1) Right click the tool bar
2) Select Customize (bottom of list)
3) Select the Toolbars tab
4) Select the Standard tool bar from the list
5) Click the Reset button
Alternatvely, run the code:
Application.CommandBars("Standard").Reset

To reset a specific control, for example, the Copy

control
on the Standard tool bar, run this code:
With Application.CommandBars("Standard")
.Controls("&Copy").Reset
End With

Regards,
Greg

-----Original Message-----
Where can I find the names of the macros for the buttons

on the standard
or any other toolbar? I have written a macro which I

would like to
assign to the 'Copy' button but I would like to be able

to reverse it
if I run into problems.


---
Message posted from http://www.ExcelForum.com/

.

.


Bob Phillips[_6_]

Names of macros for toolbar buttons
 
You can easily re-direct a built-in toolbar button to your own macro (though
I have to wonder why you would when you could add a new one of your own),
but this is how you do it. This is re-directing the Decrease Indent button
to one of my macros

With Application.CommandBars("Formatting")
With .Controls("Decrease Indent")
.OnAction = "myTest"
End With
End With

To re-set it, just use

With Application.CommandBars("Formatting")
With .Controls("Decrease Indent")
.OnAction = ""
End With
End With

The names to use can usually be found by hovering over the button and
getting the tooltip, but this code will also get them all

Dim i

With Application.CommandBars("Formatting")
For i = 1 To .Controls.Count
Debug.Print .Controls(i).Caption
Next i
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"DredanZyl " wrote in message
...
Where can I find the names of the macros for the buttons on the standard
or any other toolbar? I have written a macro which I would like to
assign to the 'Copy' button but I would like to be able to reverse it
if I run into problems.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 09:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com