Group:  Microsoft Word ยป microsoft.public.word.vba.addins
Thread: Custom Menu Add-in Not Creating Menu

Geek News

Custom Menu Add-in Not Creating Menu
Shane <shane.herring[ at ]-REMOVETHIS-gmail.com> 5/2/2007 4:56:18 AM
Hi.

I have an add-in with a cutom menu. The menu is created
programmatically i.e. not using Customize -> Command.

If I use document_new() or document_open() and either create a new
document based on the template or open the template as if it were a
doc from the filesystem, the menu appears. If I put the template in
my startup directory and restart Word the menu doesn't kick in.

What I want to see is my template in the startup directory and my
custom menu appear when Word starts and do it programmatically.

What have I done wrong?

TIA
Shane
Re: Custom Menu Add-in Not Creating Menu
"Jonathan West" <jwest[ at ]mvps.org> 5/2/2007 12:17:08 PM

"Shane" <shane.herring[ at ]-REMOVETHIS-gmail.com> wrote in message
news:756g331q9frp39h3mdl9ekm057tmvr7ir4[ at ]4ax.com...
[Quoted Text]
> Hi.
>
> I have an add-in with a cutom menu. The menu is created
> programmatically i.e. not using Customize -> Command.
>
> If I use document_new() or document_open() and either create a new
> document based on the template or open the template as if it were a
> doc from the filesystem, the menu appears. If I put the template in
> my startup directory and restart Word the menu doesn't kick in.
>
> What I want to see is my template in the startup directory and my
> custom menu appear when Word starts and do it programmatically.
>
> What have I done wrong?
>


I suspect the code is not running because the document_new() and
document_open() events don't run when you load a template as an add-in.
Instead place the code in a macro called AutoExec.

If you need to remove the menu when the add-in is unloaded, place that code
in a macro called AutoExit.

But I would probably recommend that you create the menu in the add-in using
Tools Customize, so it simply becaomes available to the user when the add-in
is loaded. There is great scope for comprehensively messing up the menu
system with code that makes changes to the menus.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

Re: Custom Menu Add-in Not Creating Menu
Shane <shane.herring[ at ]-REMOVETHIS-gmail.com> 5/2/2007 11:06:25 PM
On Wed, 2 May 2007 13:17:08 +0100, "Jonathan West" <jwest[ at ]mvps.org>
wrote:

[Quoted Text]
>I suspect the code is not running because the document_new() and
>document_open() events don't run when you load a template as an add-in.
>Instead place the code in a macro called AutoExec.
>
>If you need to remove the menu when the add-in is unloaded, place that code
>in a macro called AutoExit.
>
>But I would probably recommend that you create the menu in the add-in using
>Tools Customize, so it simply becaomes available to the user when the add-in
>is loaded. There is great scope for comprehensively messing up the menu
>system with code that makes changes to the menus.

Tks Jonathan. I've use the customise option in the past but have
always had "issues" with menus being duplicated (any suggestions
herer?). I also have clients running Acrobat add-ins and this has
caused me grief as well. I'm looking at using code as a comparison
and to be able to give me options in the future.

Thanks again for the fix and the suggestion.

Cheers
Shane

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net