Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to add menu button to exisiting menubar

I see a lot in previous posts on adding a whole new nenu...but I want
to add a new button (on the workbook open & remove on the workbook
before close events) to the Chart menu and assign a macro to it. I am
using XL2000. I am missing something in my attempts to add a single
button (not a pop-up) to an already existing menu.

Thanks in advance for the advice.

Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default How to add menu button to exisiting menubar

This works:

Sub AddNewItem()
Dim ctlNew As CommandBarControl
Set ctlNew = CommandBars("Chart Menu Bar").Controls _
("Chart").Controls.Add(msoControlButton, , , , True)
With ctlNew
.Style = msoButtonCaption
.Caption = "MyNewItem"
.Visible = True
.OnAction = "MyNewMacro"
End With
End Sub

Sub MyNewMacro()
MsgBox "Success!"
End Sub

--

Vasant

"Mike P" wrote in message
om...
I see a lot in previous posts on adding a whole new nenu...but I want
to add a new button (on the workbook open & remove on the workbook
before close events) to the Chart menu and assign a macro to it. I am
using XL2000. I am missing something in my attempts to add a single
button (not a pop-up) to an already existing menu.

Thanks in advance for the advice.

Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to add menu button to exisiting menubar

Thanks, any idea on best way to delete the new menu button?

Actually, can someone describe the overal menu structure? That is
where I am having trouble understanding here. Thanks.

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ...
This works:

Sub AddNewItem()
Dim ctlNew As CommandBarControl
Set ctlNew = CommandBars("Chart Menu Bar").Controls _
("Chart").Controls.Add(msoControlButton, , , , True)
With ctlNew
.Style = msoButtonCaption
.Caption = "MyNewItem"
.Visible = True
.OnAction = "MyNewMacro"
End With
End Sub

Sub MyNewMacro()
MsgBox "Success!"
End Sub

--

Vasant

"Mike P" wrote in message
om...
I see a lot in previous posts on adding a whole new nenu...but I want
to add a new button (on the workbook open & remove on the workbook
before close events) to the Chart menu and assign a macro to it. I am
using XL2000. I am missing something in my attempts to add a single
button (not a pop-up) to an already existing menu.

Thanks in advance for the advice.

Mike

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default How to add menu button to exisiting menubar

CommandBars("Chart Menu Bar").Controls _
("Chart").Controls("MyNewItem").Delete

I'll pass on trying to describe the overall menu structure as it is quite
complicated :-).

--

Vasant

"Mike P" wrote in message
om...
Thanks, any idea on best way to delete the new menu button?

Actually, can someone describe the overal menu structure? That is
where I am having trouble understanding here. Thanks.

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message

...
This works:

Sub AddNewItem()
Dim ctlNew As CommandBarControl
Set ctlNew = CommandBars("Chart Menu Bar").Controls _
("Chart").Controls.Add(msoControlButton, , , , True)
With ctlNew
.Style = msoButtonCaption
.Caption = "MyNewItem"
.Visible = True
.OnAction = "MyNewMacro"
End With
End Sub

Sub MyNewMacro()
MsgBox "Success!"
End Sub

--

Vasant

"Mike P" wrote in message
om...
I see a lot in previous posts on adding a whole new nenu...but I want
to add a new button (on the workbook open & remove on the workbook
before close events) to the Chart menu and assign a macro to it. I am
using XL2000. I am missing something in my attempts to add a single
button (not a pop-up) to an already existing menu.

Thanks in advance for the advice.

Mike



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to add menu button to exisiting menubar

Thanks. I actually figured it out before you replyed, and that has
given me a better feel for how the menus are done.

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ...
CommandBars("Chart Menu Bar").Controls _
("Chart").Controls("MyNewItem").Delete

I'll pass on trying to describe the overall menu structure as it is quite
complicated :-).

--

Vasant

"Mike P" wrote in message
om...
Thanks, any idea on best way to delete the new menu button?

Actually, can someone describe the overal menu structure? That is
where I am having trouble understanding here. Thanks.

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message

...
This works:

Sub AddNewItem()
Dim ctlNew As CommandBarControl
Set ctlNew = CommandBars("Chart Menu Bar").Controls _
("Chart").Controls.Add(msoControlButton, , , , True)
With ctlNew
.Style = msoButtonCaption
.Caption = "MyNewItem"
.Visible = True
.OnAction = "MyNewMacro"
End With
End Sub

Sub MyNewMacro()
MsgBox "Success!"
End Sub

--

Vasant

"Mike P" wrote in message
om...
I see a lot in previous posts on adding a whole new nenu...but I want
to add a new button (on the workbook open & remove on the workbook
before close events) to the Chart menu and assign a macro to it. I am
using XL2000. I am missing something in my attempts to add a single
button (not a pop-up) to an already existing menu.

Thanks in advance for the advice.

Mike

Reply
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
Blank Worksheet Displays Opening Exisiting Workbook Sherrie New Users to Excel 1 September 11th 07 02:42 PM
How to Edit an Exisiting Drop-Down List in Excel 2003 Fabs Excel Discussion (Misc queries) 0 July 11th 07 03:40 PM
Auto Row Height in Merged Cells with pre exisiting text gwinder Excel Worksheet Functions 2 December 14th 06 05:31 PM
I want to copy only the layout and formulas and not the exisiting edv Excel Discussion (Misc queries) 1 June 10th 05 12:08 PM
Seagate Button on Menu Warman Excel Discussion (Misc queries) 2 January 14th 05 02:41 PM


All times are GMT +1. The time now is 06:31 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"