MS Office Custom Menu
Posted on 2009-12-31
I have a subform on an Access form. When you right click on the record selector of the datasheet, you currently get a standard right click popup menu (Form Datasheet Row)that lists the available actions (Cut, Paste, Delete Record, etc). Here is what I want to happen:
1) When I right click on the subform record selector, I do not want to see the original built-in right-click menu.
2) I want to see a custom menu that lists a completely different list of options.
3) I want the new custom menu to be set to "Temporary", so that it unloads at progam shut-down.
4) I want the original right-click menu to still be available at a later date.
I can write something like the below listed code to add a new popup menu, but I do not know how to make it replace the existing built-in menu. If I name my new custom menu the same name as this existing right-click menu, then I obviously get an error since a menu by the same name already exists.
So how do I assign/build a new temporary right-click menu in place of the original right click menu?
Dim oMenu As Office.CommandBar
Set oMenu = Application.CommandBars.Add("Form Datasheet Row", msoFloating, False, True)
oMenu.Visible = True