Templates and Custom Menus

Templates and Custom Menus

Post by dGQ » Thu, 29 Mar 2007 09:22:32

I have a set of Word Macros that I want to run from a custom menu. I want to
be able to have these menus (and submenus) show up for a set of Word
documents that I keep in a certain folder. In other words, my menu would
show "File, Edit, View, Insert, Tools, Window, Help, Topics," where Topics is
my custom menu.

I tried this some time ago in a similar set of Word code, and ran into a
problem. Unfortunately I don't have that code available to tell you exactly
what I was doing, but I'll explain the general problem. Also, I know just
enough VBA to be dangerous. Unfortunately, I have to get certain things
done, so I end up having to dabble. So please forgive any ignorance I show.

First, a bit of what I remember about how the code was set up. There was a
subroutine called CreateMenu, in which we had code to generate the menu and
submenus, and to link those submenus to various macros. If I remember
correctly, we ran this subroutine at the start of the project, and it created
the menus, and then we just attached that template to each file in the folder
that we wanted to use those menus and macros with. Things worked perfectly,
and we were able to use those macros for the rest of the project. All team
members saw the menu, and had no problems using the menu.

On the second project, things got a little hairy. I went in and changed the
code to show the new categories and macros that we wanted in the menu, but
when I attached the template to the new files, the old menu still showed up!
I think I figured out that I had to delete the old menu from the template and
re-run the CreateMenu subroutine, but I still had problems. On my computer
the new menu would show up when I opened any of the files, but other team
members would open the files and find no menu (and yes, they had macros

I'm trying to write a very very similar program, and need to avoid these
problems. I'm sorry I don't have the code from our old program available,
but if anyone has any insight into what was happening, and how to avoid that
problem, I would appreciate it. My main questions are...

How could I have the menus while the other team members did not have them,
if we were opening the same files with the same template attached to those

How do I fix that problem?

Thanks for any help.

Templates and Custom Menus

Post by Anne Tro » Thu, 29 Mar 2007 15:06:26

Hi, td. Try this:
Also, be sure your code "removes" the toolbar that it creates. I think
that's what happened when you previously had issues.
Hope it helps!
Anne Troy