Discussion:
Custom toolbar in global template
(too old to reply)
Brandon
2004-10-07 03:13:45 UTC
Permalink
Hi-

I realize there have been multiple posts relating to this topic
already, but after sifting through a sampling of 5 or 10 of them, so
far I haven't been able to verify that any of the proposed suggestions
actually solve the problem.

I'm running Word2k on a Win2k box. Ultimately what I'd like to
achieve is a global template that causes a custom popup control to
appear on the main menu bar. At first I tried building the popup with
Autoexec, then deleting it with AutoExit. As others have observed,
the building part works fine, & the deleting part appears to work fine
at first, but if I then remove the global template from my startup
directory and restart Word, the popup still shows up on the menu. I
assume this means that my AutoExec build procedure is binding the
popup to Normal instead of to my global.

So next I tried adding
ActiveDocument.CustomizationContext=ThisDocument.AttachedTemplate just
before my calls to the Build and Delete procedures. Here the behavior
is a bit strange & seems to have some kind of timing issue. When I
open Word (with the global loaded), it appears to create a new
document, then executes the AutoExec procedure which Builds the popup.
I see the popup appear in the menu. After AutoExec finishes, the
popup disappears - despite the fact that my Delete function isn't
called. If I then close the doc, remove the template from the startup
directory, and open Word again, the popup again shows up in the main
menu, similar to the situation with the first case above. After
thinking about it a bit, I'm guessing that
ThisDocument.AttachedTemplate is still going to point to Normal since
the global template isn't attached, it's loaded. Normal is the
template that's attached (at least in this particular case).

Lastly, I tried building the popup in the template itself & saving the
template with the popup visible in the main menu, which should mean I
don't need to Build/Delete the popup programatically each time Word
loads the template. This works great when I use the template as a
regular document template. But if I try to use it as a global, the
popup doesn't appear. I assume this results from some kind of
prioritization in which the menu at the document-level is superceding
the menu at the global-level. Unfortunately I don't know how to
access the menu stored in the global programatically in order to
display it instead of the document menu (even assuming this is the
problem).

I'm tearing my hair out at this point. If anyone has any suggestions
at all, I'd really appreciate it. I don't really care what mechanism
I use to make this happen, i.e. dynamic build/delete or static load,
just so long as it WORKS.

Thanks,
Brandon
Tom Winter
2004-11-10 14:36:41 UTC
Permalink
Creating the menu (by hand or programmatically) at design time in the actual
template and then using the template as a traditional add-in should work
just fine. I've been doing that for the last 9 years since Word 6.0 and have
never had any problems with it.

My guess here is that you've got some strange template attached to the
document that's making the add-in's menu disappear. Perhaps the
attached-template's menu has been customized to "remove" the menu you've
added to the addin-template. Does the add-in's menu show up when you have
open a blank document based on normal.dot? Maybe delete your normal.dot and
start over. I now I'm getting a little far fetched here, but you should be
able to get things to work without resorting to anything strange or needed
special code.
--
Tom Winter
***@NoSpam.AmosFiveSix.com
www.AmosFiveSix.com
Post by Brandon
Hi-
I realize there have been multiple posts relating to this topic
already, but after sifting through a sampling of 5 or 10 of them, so
far I haven't been able to verify that any of the proposed suggestions
actually solve the problem.
I'm running Word2k on a Win2k box. Ultimately what I'd like to
achieve is a global template that causes a custom popup control to
appear on the main menu bar. At first I tried building the popup with
Autoexec, then deleting it with AutoExit. As others have observed,
the building part works fine, & the deleting part appears to work fine
at first, but if I then remove the global template from my startup
directory and restart Word, the popup still shows up on the menu. I
assume this means that my AutoExec build procedure is binding the
popup to Normal instead of to my global.
So next I tried adding
ActiveDocument.CustomizationContext=ThisDocument.AttachedTemplate just
before my calls to the Build and Delete procedures. Here the behavior
is a bit strange & seems to have some kind of timing issue. When I
open Word (with the global loaded), it appears to create a new
document, then executes the AutoExec procedure which Builds the popup.
I see the popup appear in the menu. After AutoExec finishes, the
popup disappears - despite the fact that my Delete function isn't
called. If I then close the doc, remove the template from the startup
directory, and open Word again, the popup again shows up in the main
menu, similar to the situation with the first case above. After
thinking about it a bit, I'm guessing that
ThisDocument.AttachedTemplate is still going to point to Normal since
the global template isn't attached, it's loaded. Normal is the
template that's attached (at least in this particular case).
Lastly, I tried building the popup in the template itself & saving the
template with the popup visible in the main menu, which should mean I
don't need to Build/Delete the popup programatically each time Word
loads the template. This works great when I use the template as a
regular document template. But if I try to use it as a global, the
popup doesn't appear. I assume this results from some kind of
prioritization in which the menu at the document-level is superceding
the menu at the global-level. Unfortunately I don't know how to
access the menu stored in the global programatically in order to
display it instead of the document menu (even assuming this is the
problem).
I'm tearing my hair out at this point. If anyone has any suggestions
at all, I'd really appreciate it. I don't really care what mechanism
I use to make this happen, i.e. dynamic build/delete or static load,
just so long as it WORKS.
Thanks,
Brandon
Loading...