PC Review


Reply
Thread Tools Rate Thread

Deleting custom menu item createt in VBA

 
 
HenrikH
Guest
Posts: n/a
 
      25th Jun 2009
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?
 
Reply With Quote
 
 
 
 
HenrikH
Guest
Posts: n/a
 
      25th Jun 2009
BTW I would also like to be able to control where the menu item i
placed in the submenu. Now its added as the last item in the "Send To"
submenu but I would like it to be the 4th entry.

Is that possible.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete specific menu item from custom menu Tim Microsoft Excel Programming 2 11th Mar 2008 12:45 PM
Adding Sub Menu Item to Current Custom Menu =?Utf-8?B?UmVuYXRv?= Microsoft Excel Programming 2 19th Dec 2005 12:48 AM
Not able to call a function from custom menu item that is added in word menu(File) jayrm100@yahoo.com Microsoft Word Document Management 0 9th Nov 2005 05:36 AM
Deleting a Top Menu Bar item? Joseph Microsoft Word New Users 1 11th Mar 2004 06:49 AM
I create a menu item using VB, within a custom contacts form. I do not want the item to be visible in other forms or views. How do I do this?? Tore Microsoft Outlook Form Programming 0 10th Mar 2004 01:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:08 PM.