Editing Menu Items

doulostheou

Registered User.
Local time
Today, 17:14
Joined
Feb 8, 2002
Messages
314
I am creating a custom menu bar for my application. I have noticed that if I modify the default menu, it changes it for all Access applications; so I have decided not to do this. I created a new menu bar and I have the standard menu items (File, Edit, View, Window, etc.) with only the options I need. My problem comes with the Window menu. I can get Tile Horizontally/Vertically/Cascade, and I've added Refresh. But I also want a list of the available windows that the user can click on. I'm guessing I'll have to write code to do this, but I'm not sure how Microsoft went about it. Any help would be appreciated.
 
Custom Menus

You need to start by adding a "Custom" menu.

Right-click the menu bar and select customize to open the "Customize" dialog.

Select the "Commands" tab, and then "Files" from the "Categories" listbox.

Select "Custom" from the "Commands" list and drag this option onto your toolbar (drop it somewhere on the "Window" menu).

Leave the "Customize" dialog open. Right-click the new addition, change the Name of the control as required, and then select Properties from the context-menu.

In order to get your new menu to do something you'll need to enter something in the "On Action" property. This can be either the name of a macro, or a public function stored in a module.

For macros simply enter the name, i.e. "MyMacro" (quotes not required).

For functions prefix with an =, and include any parameters, i.e. "=MyFunc()"

The function or macro will need to do the actual work of opening the form.
 
Why don't you copy the whole window menu from the standard menu to your custom menu. If memory serves me correctly get your custom menu showing on a form then:

Right Click on the menu bar then click on customize, go to commands, and built in menus, then drag the window menu up to your menubar.

HTH
John
 
The problem with just dragging the built-in Windows menu to my custom one is that changes made to this menu appear in all Access applications. Also, the changes seemed to be saved locally. The refresh menu item I added did not appear on other computers. I moved refresh to a different menu as a temporary solution, but it really belongs in this menu.

I know how to sign an action to a menu item, but I need to know how to make the menu items behave as they do on the default Windows menu. I want the names of all open forms to appear with a 1,2,3, etc. next to them and something to indicate the one in use (Microsoft has put a check mark next to it). So I guess the code would have to manipulate the caption of the menu items and add/remove them when appropriate.
 
You will need to use the "Microsoft Office [v.v] Object Library" to manipulate menus programatically.

You can add/delete CommandBar objects from an existing menu or create entire menus from scratch.

I'm sorry that I don't have a working example, but there are examples on the MSDN site.
 

Users who are viewing this thread

Back
Top Bottom