View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
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/