Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding Macro Button on Standard Toolbar
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////// |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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////// |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding Macro Button on Standard Toolbar
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////// |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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////// |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I replicate a macro for each button on standard toolbar? | Excel Discussion (Misc queries) | |||
How do I duplicate a macro for a button on the Standard Toolbar? | Excel Discussion (Misc queries) | |||
How to get Research button on my standard toolbar? | Excel Discussion (Misc queries) | |||
I can't remove the Email button to the Standard toolbar in Excel | Excel Discussion (Misc queries) | |||
Fax Button on Standard Toolbar | Excel Discussion (Misc queries) |