Gustav Brock
asked on
Access 2010: Create custom popup menu to run custom functions
I need some help with this.
I've found out that you need a reference to the Office Object Library and then create a "commandbar" to achieve this, but the code examples I can locate just adds standard Access/Office commands to the menu using "secret" values.
My popup should be displayed when right-clicking the form pane outside the controls.
It should contain a few menu entries, say:
Create New
Reset
When clicking one of these, a function of mine should be called, like:
CreateNewOrder()
ClearOrder()
I've managed to create a shortcutmenu (macro) but, when I right-click, no menu is shown - the macro is executed right away.
I would prefer the menu to be created as "temporary".
/gustav
I've found out that you need a reference to the Office Object Library and then create a "commandbar" to achieve this, but the code examples I can locate just adds standard Access/Office commands to the menu using "secret" values.
My popup should be displayed when right-clicking the form pane outside the controls.
It should contain a few menu entries, say:
Create New
Reset
When clicking one of these, a function of mine should be called, like:
CreateNewOrder()
ClearOrder()
I've managed to create a shortcutmenu (macro) but, when I right-click, no menu is shown - the macro is executed right away.
I would prefer the menu to be created as "temporary".
/gustav
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much! This is exactly what is needed.
And just change the last parameter to True to make it temporary:
Set cmb = CommandBars.Add("MyContext ", _
msoBarPopup, False, True)
And thanks for the additional links as well.
Have a nice weekend!
/gustav
And just change the last parameter to True to make it temporary:
Set cmb = CommandBars.Add("MyContext
msoBarPopup, False, True)
And thanks for the additional links as well.
Have a nice weekend!
/gustav
http://spreadsheetpage.com/index.php/site/tip/identifying_commandbar_images/
previous code is adapted from:
https://www.experts-exchange.com/questions/22938823/Copy-commandbars-items.html