Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default 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/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default 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/

.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning Macros to Toolbar buttons JMay Excel Discussion (Misc queries) 1 July 24th 07 07:22 PM
How can you replicate macros for buttons on the Standard toolbar? Suzi Excel Discussion (Misc queries) 1 February 16th 07 09:53 PM
custom toolbar buttons are saved where? Excel loads twice bymistake and all my custom toolbar buttons get gone!!! Kevin Waite Excel Programming 2 March 3rd 04 03:31 PM
Icons on toolbar buttons (Was: Toolbars with macros) Phil Bewig Excel Programming 1 February 2nd 04 03:49 PM
Problem with macros assigned to toolbar buttons Greg Wilson[_3_] Excel Programming 1 September 8th 03 07:50 PM


All times are GMT +1. The time now is 07:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"