Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default How to delete Custom VBA Menu

I have created a VBA menu using the following code and now want to remove the
menu but can't. Any ideas on how to remove the menu and to make it go away
when I close the particular file it is attached to?

Jeff

Sub AddNewMenu()

Dim oCB As CommandBar
Set oCB = Application.CommandBars("Worksheet Menu Bar")
Dim newMenu As CommandBarControl

Set newMenu = oCB.Controls.Add(Type:=10)
With newMenu
.Caption = "Transit Manager"
.Enabled = True
With .Controls.Add(Type:=msoControlButton)
.Caption = "Start . . ."
.FaceId = 39
.OnAction = "Start_New_Process"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Import LE's"
.FaceId = 938
.OnAction = "macro2"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Import Actuals"
.FaceId = 988
.OnAction = "macro3"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Print Reduced"
.FaceId = 707
.OnAction = "macro2"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Button5"
.FaceId = 29
.OnAction = "macro1"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Finish . . ."
.FaceId = 41
.OnAction = "macro2"
End With
End With

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default How to delete Custom VBA Menu

Application.CommandBars("Worksheet Menu Bar").Controls("Tranist
Manager").Delete


--
HTH

Bob Phillips

"Jeff" wrote in message
...
I have created a VBA menu using the following code and now want to remove

the
menu but can't. Any ideas on how to remove the menu and to make it go away
when I close the particular file it is attached to?

Jeff

Sub AddNewMenu()

Dim oCB As CommandBar
Set oCB = Application.CommandBars("Worksheet Menu Bar")
Dim newMenu As CommandBarControl

Set newMenu = oCB.Controls.Add(Type:=10)
With newMenu
.Caption = "Transit Manager"
.Enabled = True
With .Controls.Add(Type:=msoControlButton)
.Caption = "Start . . ."
.FaceId = 39
.OnAction = "Start_New_Process"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Import LE's"
.FaceId = 938
.OnAction = "macro2"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Import Actuals"
.FaceId = 988
.OnAction = "macro3"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Print Reduced"
.FaceId = 707
.OnAction = "macro2"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Button5"
.FaceId = 29
.OnAction = "macro1"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Finish . . ."
.FaceId = 41
.OnAction = "macro2"
End With
End With

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default How to delete Custom VBA Menu

Thanks Bob, worked like a charm

JEff

"Bob Phillips" wrote:

Application.CommandBars("Worksheet Menu Bar").Controls("Tranist
Manager").Delete


--
HTH

Bob Phillips

"Jeff" wrote in message
...
I have created a VBA menu using the following code and now want to remove

the
menu but can't. Any ideas on how to remove the menu and to make it go away
when I close the particular file it is attached to?

Jeff

Sub AddNewMenu()

Dim oCB As CommandBar
Set oCB = Application.CommandBars("Worksheet Menu Bar")
Dim newMenu As CommandBarControl

Set newMenu = oCB.Controls.Add(Type:=10)
With newMenu
.Caption = "Transit Manager"
.Enabled = True
With .Controls.Add(Type:=msoControlButton)
.Caption = "Start . . ."
.FaceId = 39
.OnAction = "Start_New_Process"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Import LE's"
.FaceId = 938
.OnAction = "macro2"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Import Actuals"
.FaceId = 988
.OnAction = "macro3"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Print Reduced"
.FaceId = 707
.OnAction = "macro2"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Button5"
.FaceId = 29
.OnAction = "macro1"
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Finish . . ."
.FaceId = 41
.OnAction = "macro2"
End With
End With

End Sub




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
Delete custom menu bars Martin Walter Setting up and Configuration of Excel 1 June 27th 06 01:15 PM
VBA - Disappearing custom menu and custom toolbar Peter[_50_] Excel Programming 2 December 2nd 04 06:09 PM
Custom Menu Todd Huttenstine Excel Programming 6 August 21st 04 02:30 PM
Custom Menu return to Excel Menu upon Closing VetcalcReport Excel Programming 2 August 2nd 04 02:59 PM
Custom Menu Luis Excel Programming 1 December 12th 03 01:54 PM


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