Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default how to permantly delete a custom menu in excel

hi,

I met a very strange problem with Excel.

Firstly I created a custom menu using the following VBA snippet

Sub add_menu()
Dim cmd_Bar As CommandBar
Dim menu_Intranet As CommandBarControl
Set cmd_Bar = Application.CommandBars("Worksheet Menu Bar")
Set menu_Intranet = cmd_Bar.Controls.Add(Type:=10, Temporary:=True)
menu_Intranet.Caption = "Intranet Entry"
End Sub

Then a custom menu appeared on the run time. However, after I closed the
excel, and reopened it without running any VBA Code, the same menu appeared,
which is very surprising. Then I used the following code to programmtically
delete the menu,

Sub delete_menu()
Dim cmd_Bar As CommandBar
Dim menu_Intranet As CommandBarControl

Set cmd_Bar = Sheet1.Application.CommandBars("Worksheet Menu Bar")
For Each menu_Intranet In cmd_Bar.Controls
If menu_Intranet.Caption = "Intranet Entry" Then
menu_Intranet.Delete
End If
Next
End Sub

Although such code can delete the menu on the run time as expected, when I
close and reopne excel, the custom menu is still then.

I would greatly appreciate if anyboday can tell me how to persuade this
little baby to diappear permantly. Thanks in advance.


--
John 3:16
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
excel 2007 add custom menu ILearner Excel Discussion (Misc queries) 17 April 17th 07 07:18 PM
Delete custom menu bars Martin Walter Setting up and Configuration of Excel 1 June 27th 06 01:15 PM
Adding Sub Menu Item to Current Custom Menu Renato Excel Programming 2 December 19th 05 12:48 AM
How to delete Custom VBA Menu Jeff Excel Programming 2 January 20th 05 02:19 AM
Custom Menu return to Excel Menu upon Closing VetcalcReport Excel Programming 2 August 2nd 04 02:59 PM


All times are GMT +1. The time now is 08:02 AM.

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"