PDA

View Full Version : Solved: How do I create a drop-down list on the Menu Bar?



Greg
06-27-2006, 05:27 PM
In a document with more than one Userform, how do I create a drop-down list on the Menu bar so that I can select which macro I want to execute?

Any help will be appreciated.

fumei
06-27-2006, 09:45 PM
That there is more than one Userform is irrelevant. It makes no difference at all. What you can do is list macros (procedures). One of them can call up a userform, or whatever.

Choose the toolbar you want to add to. You can add a new menu item, a new icon, or add to an existing menu item. Let's pick Tools on the Menu Bar.

1. Right click Menu Bar and select Customize.
2. Select the Commands tab.
3. Select Macros from Categories.
4. Find the macro you want to add.

NOTE: this may be more difficult than you think. Categories / Macros will list ALL macros currently available. This includes all macros in normal.dot, any global templates, the current attached template, and the current document. Further, in some versions of Word, the bloody display window is too small - and NOT scrollable! Therefore you can not see the whole name. This is VERY annoying. For example, the following procedure:

TemplateProject.modFormFields.GetDDList

on my machine is a procedure in a loaded global template (VBAXTools.dot). Notice the template file is NOT listed. Also, the maximum visible in the window is:

TemplateProject.modFormField

so, as I have over 20 procedures in that module, I have NO way of knowing which one to select. It is trial and error, OK not really as it is alphabetical...but still VERY annoying if you have lots of procedures. That template file has more than 200...

5. Drag the macro from the macro window to Tools on the Menu Bar. The Tools menu dropdown will open. Keep dragging the macro until you have it the location you want it, and release.

I would suggest making a new Menu Item, then loading your macros there.

Also, note that when you first release the macro, the display Name will be the full macro "path" - eg. TemplateProject.modFormFields.GetDDList

The Name property will be active. Just select it, and delete what you don't need of the name text, or type a new name. You can rename it whatever you want. The Name property is a display name, it does not affect the pointer to the procedure.

6. Select Close to finish.