LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Deleting custom menu item createt in VBA

Hi i've have a macro setting up a custom menu item in the Files, Send
To menu (ie in at submenu to the files menu).

The macro is set in the ThisWorkbook section but i cannot figure out
how to delete it again (i get multiple items of it).

The code looks like this:

' Code for creating the menu item
Sub InsertMenuItem()
Dim RowMenu As CommandBarControl
Dim NewMenuItem As CommandBarButton
'Find menuitem Row
Set RowMenu = CommandBars(1).FindControl(ID:=30095,
recursive:=True)
'Insert new menuitem (button)
Set NewMenuItem = RowMenu.Controls.Add(Type:=msoControlButton)
With NewMenuItem
.Caption = "Postmodtager (som vedhæftet PDF)..."
.FaceId = 5622
.OnAction = "SendPDFSomMail"
End With
End Sub

' Code for putting the item in the menu
Private Sub Workbook_Open()
MyNewMenu HideMe
InsertMenuItem
End Sub

I know I have to put the code to delete it in an Workbook_BeforeClose
sub but cannot get anything to work. All examples i find is to delete
an entire menu and not a single menu item.

Any ideas?
 
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
How to display a custom menu item TDay Excel Programming 1 May 16th 09 02:16 PM
Delete specific menu item from custom menu Tim Excel Programming 2 March 11th 08 12:45 PM
Context-sensitive custom menu item. Murray Excel Programming 7 December 28th 05 04:55 AM
Adding Sub Menu Item to Current Custom Menu Renato Excel Programming 2 December 19th 05 12:48 AM
VBA-Make Custom Menu Item Fire d_rodman Excel Programming 3 July 27th 04 03:29 PM


All times are GMT +1. The time now is 01:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"