Adding Macro Button on Standard Toolbar
Thanks,
I've got the Workbook at work. I'll try it first thing in the morning.
Jeff
"sebastienm" wrote in message
...
Just tried it, it should be the msoButtonCaption. In your code, add:
MenuItem.Style = msoButtonCaption
Regards,
Sebastien
"Jeff Harbin" wrote:
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//////
|