View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jeff Harbin[_2_] Jeff Harbin[_2_] is offline
external usenet poster
 
Posts: 16
Default Adding Macro Button on Standard Toolbar

How would I do that. The help on this topic isn't very useful.




"sebastienm" wrote in message
...
Maybe try to set the Style property to
msoButtonIcon
or
msoButtonCaption

regards,
Seb

"Jeff Harbin" wrote:

I'm trying to add a custom button on the normal menu bar that will run a
macro when clicked and I've almost got it with a couple of quirks.

1. The code below adds the button and it runs the correct code but the
button has not label. My intention is that the second line of code
(MenuItem.Caption = "Start New Roll") is what should appear on the menu
button. Instead the button has no caption and unless you knew it was

there
you wouldn't see it. Instead of the label being "Start New Roll", the

"Start
New Roll" text comes up as if it were a ToolTip. I have had some

success of
identifying the macro button by putting an icon in it but I'd rather

not.
I've been adding the icon by specifying an integer value in the ID

variable
of the .Add method.

///code start/////
Dim MenuItem as Object

Set MenuItem = Application.CommandBars("Worksheet Menu
Bar").Controls.Add(msoControlButton, , , 13, True)

MenuItem.Caption = "Start New Roll"

MenuItem.OnAction = "DisplayMessage"
////code end//////