Why using AutoExit don't delete CommandBarControl from menu?

A

avkokin

Hello.
There is one template which has 3 macro. First macro is called
"AutoExec". It create one menu item into menu FILE. The click on this
item launches other macro (3-st macro). Second macro is called
"AutoExit" It delete new menu item from menu FILE.
I placed my template to the folder "StartUp" for Word.
When I start Word into menu File is creates my item. Next I close Word
and delete (manually) my template from folder "StartUp". Again start
Word and see that new menu item wasn't deleted - it there.
Why? I know that auto macro "AutoExit" is run when closing Word or
template. But why then my macro don't run?
Thank you.
 
J

Jean-Guy Marcil

avkokin said:
Hello.
There is one template which has 3 macro. First macro is called
"AutoExec". It create one menu item into menu FILE. The click on this
item launches other macro (3-st macro). Second macro is called
"AutoExit" It delete new menu item from menu FILE.
I placed my template to the folder "StartUp" for Word.
When I start Word into menu File is creates my item. Next I close Word
and delete (manually) my template from folder "StartUp". Again start
Word and see that new menu item wasn't deleted - it there.
Why? I know that auto macro "AutoExit" is run when closing Word or
template. But why then my macro don't run?

Here is what the VBA help has to say regarding Auto macros:

"
Just like other macros, auto macros can be stored in the Normal template,
another template, or a document. In order for an auto macro to run, it must
be either in the Normal template, in the active document, or in the template
on which the active document is based. The only exception is the AutoExec
macro, which will not run automatically unless it is stored in one of the
following: the Normal template, a template that is loaded globally through
the Templates and Add-Ins dialog box, or a global template stored in the
folder specified as the Startup folder.

"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top