PDA

View Full Version : Solved: Word2003 Menu Behavior



MWE
07-25-2008, 07:50 PM
I have recently upgraded from Office2000 to Office2003. As I recollect, temporary menu created with VBA in Word2000 were persistent, i.e., they stayed even after Word exited. Not a big deal, just add something to the Before_Close macro to trash the menu. It appears that Word2003 has a different bug. Temporary menus stay when Word exits, but they are often corrupted so that when Word is started again, the top level menu is there but the actual menu pics are what were submenu picks previously.

As an example, a VBA procedure creates a temp menu called "A" with menu items A1, A2 and A3. A3 has two menus beneath it, A31 and A32:
A
A1
A2
A3
A31
A32
I close the application that created "A" and restart Word. 50% of the time, "A" is still there on the menu bar and its picks are correct, but the other 50% of the time "A" is still there, but now contains just A31 and A32.
A
A31
A32

:dunno

If I manually create "B" with the same menu structure as "A" above, it is by definition a permanent menu and it is quite persistent and is not corrupted.

Has anyone had a problem like this and/or might suggest why this is happening?

UPDATE: I should probably also pose another question: Is there some sort of natural (or unnatural?) rule that states that posting to this forum automatically fixes any "mysterious" problem one might have. I think this is worthy of investigation. 1) Simply preparing the post forces you to think very carefully about what is happening and sometimes that is enough for you to recognize what is wrong. Not that this has ever happened to me ... :devil2: But I have also experienced several cases where the process of post preparation did not yield an answer, so I did post and then discovered that the problem has mysteriously disappeared and could not be duplicated even though it was easy to duplicate before the item was posted

lucas
07-27-2008, 10:06 AM
Word 2003 menu's are much better than Excel's. You really don't need vba at all to accomplish this.

Take a look at this (http://slucas.virtualave.net/Wink/CustomMenuItem.htm).

If you want the menu to always be there when you open word then just use the above method and put it in a global.dot(template) and put that file in your startup directory.

You can add submenu's too, just select new menu at the bottom of the list the first time and add your macro's to that new menu.

MWE
07-27-2008, 09:24 PM
Word 2003 menu's are much better than Excel's. You really don't need vba at all to accomplish this.

Take a look at this (http://slucas.virtualave.net/Wink/CustomMenuItem.htm).

If you want the menu to always be there when you open word then just use the above method and put it in a global.dot(template) and put that file in your startup directory.

You can add submenu's too, just select new menu at the bottom of the list the first time and add your macro's to that new menu.I disagree. The approach you suggest is really no different than manually creating menus in any MS application and still has all the same problems that previous versions of Word had. For example, the window that displays the macro names is still not scaleable; so if you have module names more than a few characters and procedures names more than a few characters, you can not see enough of the proc name to select it. It's stupid. I also disagree that Word2003 has better menu building cpability than Excel. In my experience, Excel is far superior to Word in terms of menu building tools. But we can agree to disagree :devil2:

That is not the issue. I am way beyond simply menus. I have dozens of Word-based applications that create their own menus on the fly using a table driven menu builder. It has worked perfectly for 5 years in every Office2000 application. It works fine in Excel2003 and initially works great in Word2003. But the menus created (and some are pretty complicated) are not persistent in Word. As indicated above, they are initially as they are supposed to be and then suddenly they are corrupt.

lucas
07-28-2008, 06:03 AM
Mark, guess your right, we will have to agree to disagree. It was just a suggestion and I still see no reason to use VBA if it is not necessary and building menu's in Word is simple and reliable without vba.

I guess you could post your code so someone could take a look at it. It's obviously doing something unexpected. Sorry I wasn't able to offer a better solution.

MWE
08-18-2008, 08:17 PM
Mark, guess your right, we will have to agree to disagree. It was just a suggestion and I still see no reason to use VBA if it is not necessary and building menu's in Word is simple and reliable without vba.

I guess you could post your code so someone could take a look at it. It's obviously doing something unexpected. Sorry I wasn't able to offer a better solution. I have left this thread alone while I looked more carefully at the problem and explored similar problems others might have. First, the reason for using VBA to build menus in Word instead of Word's menu building tools is:

there are two dozen separate menus to be built, removed, built again, etc
some menus have 20 or 30 picks in total in several submenus
I want the menus available only when the relevant application is running
this needs to "work" on several different computers I use
some applications and associated menus are used by others Using some sort of table-driven menu builder is the only practical approach. I wrote mine about 6 years ago initially modeled after something I saw in one of John Walkenbach?s Power Excel Programming books. It works flawlessly in other MS applications and worked fine in Word2000 except for Word2k?s inconsistent Normal.dot behavior.

That said, there IS a problem with Word2003 menus but it is apparently not Microsoft's fault. The culprit is the PDFMaker add-in supplied by Adobe
as part of Adobe Acrobat. Each of the last several versions of Acrobat has found a different way to completely mess up other people's menus on the menu bar. I uninstalled Adobe Acrobat and the problems went away. Reinstalled PDFMaker, the problems came back. Uninstalled again, problems went away. I have been able to run w/o problems for several days, so I am fairly sure I have found the problem.

I have also done some looking at other tools for pdf file management instread of Adobe's. There are some pretty interesting tools out there that work better and are a lot cheaper.