Deleting Menu

G

Guest

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
 
J

Jim Rech

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


--
Jim
| 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
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top