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

 
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
How do I replicate a macro for each button on standard toolbar? Suzi Excel Discussion (Misc queries) 2 February 16th 07 11:25 PM
How do I duplicate a macro for a button on the Standard Toolbar? Suzi Excel Discussion (Misc queries) 1 February 13th 07 11:38 PM
How to get Research button on my standard toolbar? justpeeking89 Excel Discussion (Misc queries) 0 March 26th 06 11:50 PM
I can't remove the Email button to the Standard toolbar in Excel Valerie Dyet Excel Discussion (Misc queries) 0 December 16th 05 08:10 PM
Fax Button on Standard Toolbar Bruce Excel Discussion (Misc queries) 1 April 19th 05 10:35 PM


All times are GMT +1. The time now is 07:44 PM.

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"