ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting Menu (https://www.excelbanter.com/excel-programming/336375-deleting-menu.html)

Ravi

Deleting Menu
 
Hello:

I added a new custom menu

using the follwing the code

Sub CreateMenu()
Dim DataMenu As CommandBarPopup
Dim NewMenuItem As CommandBarButton


Set DataMenu = CommandBars(1).FindControl(ID:=30011)

Set NewMenuItem = DataMenu.Controls.Add _
(Type:=msoControlButton)
With NewMenuItem
.Caption = "&eeprom"
.OnAction = "emc"
.BeginGroup = True
End With

End Sub

Sub emc()
UserFormEMC.Show
End Sub

This works and added a menu eeprom in main menu data.

I am not able to delete the menu eeprom ? How do I do that?

Thanks in advance

Ravi



Jim Rech

Deleting Menu
 
Sub DeleteIt()
Dim DataMenu As CommandBarPopup
Set DataMenu = CommandBars(1).FindControl(ID:=30011)
On Error Resume Next
DataMenu.Controls("&eeprom").Delete
End Sub


--
Jim
"ravi" wrote in message
...
| Hello:
|
| I added a new custom menu
|
| using the follwing the code
|
| Sub CreateMenu()
| Dim DataMenu As CommandBarPopup
| Dim NewMenuItem As CommandBarButton
|
|
| Set DataMenu = CommandBars(1).FindControl(ID:=30011)
|
| Set NewMenuItem = DataMenu.Controls.Add _
| (Type:=msoControlButton)
| With NewMenuItem
| .Caption = "&eeprom"
| .OnAction = "emc"
| .BeginGroup = True
| End With
|
| End Sub
|
| Sub emc()
| UserFormEMC.Show
| End Sub
|
| This works and added a menu eeprom in main menu data.
|
| I am not able to delete the menu eeprom ? How do I do that?
|
| Thanks in advance
|
| Ravi
|
|



Ron de Bruin

Deleting Menu
 
Also good info here

http://support.microsoft.com/default...02&Product=xlw
How to customize menus and menu bars in Excel

http://www.j-walk.com/ss/excel/tips/tip53.htm
Creating Custom Menus (John Walkenbach) TIP

http://www.erlandsendata.no/english/...oadcommandbars
Ole P. Erlandsen's Web Site (Example workbooks)


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jim Rech" wrote in message ...
Sub DeleteIt()
Dim DataMenu As CommandBarPopup
Set DataMenu = CommandBars(1).FindControl(ID:=30011)
On Error Resume Next
DataMenu.Controls("&eeprom").Delete
End Sub


--
Jim
"ravi" wrote in message
...
| Hello:
|
| I added a new custom menu
|
| using the follwing the code
|
| Sub CreateMenu()
| Dim DataMenu As CommandBarPopup
| Dim NewMenuItem As CommandBarButton
|
|
| Set DataMenu = CommandBars(1).FindControl(ID:=30011)
|
| Set NewMenuItem = DataMenu.Controls.Add _
| (Type:=msoControlButton)
| With NewMenuItem
| .Caption = "&eeprom"
| .OnAction = "emc"
| .BeginGroup = True
| End With
|
| End Sub
|
| Sub emc()
| UserFormEMC.Show
| End Sub
|
| This works and added a menu eeprom in main menu data.
|
| I am not able to delete the menu eeprom ? How do I do that?
|
| Thanks in advance
|
| Ravi
|
|






All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com