Prevent document AutoOpen.MAIN

J

johnny p

We are using a commercial requirements managment app which includes the
ability to import and export word documents. During an export, this app
automatically inserts code into the document AutoOpen.MAIN sub. I want to
prevent the exported word docs AutoOpen.MAIN sub from executing and instead
execute my own custom code on startup.

Is their a method to prempt the document AutoOpen.MAIN sub (and disable it?)
programmatically? I copied my custom code into the global template
AutoOpen.MAIN hoping it would take precedence over the document
AutoOpen.MAIN, but that didn't work. Is it possible to somehow only disable
the document AutoOpen.MAIN entirely (ActiveX, registry) ? I asked the vendor
of the app but they weren't too helpful. Any suggestions will be extremely
appreciated.
 
C

Charles Kenyon

A macro in a document having the same name will intercept any in a global.

You can set your macrosecurity to medium and disable macros in the document
as it is opened.
 
J

johnny p

Maybe my previous message wasn't clear enough. This word document has other
macros which are used (hence disabling all macros isn't an option). I merely
want to disable and override the behavior of the document AutoOpen.MAIN, not
all macros.
 
J

Jay Freedman

We are using a commercial requirements managment app which includes the
ability to import and export word documents. During an export, this app
automatically inserts code into the document AutoOpen.MAIN sub. I want to
prevent the exported word docs AutoOpen.MAIN sub from executing and instead
execute my own custom code on startup.

Is their a method to prempt the document AutoOpen.MAIN sub (and disable it?)
programmatically? I copied my custom code into the global template
AutoOpen.MAIN hoping it would take precedence over the document
AutoOpen.MAIN, but that didn't work. Is it possible to somehow only disable
the document AutoOpen.MAIN entirely (ActiveX, registry) ? I asked the vendor
of the app but they weren't too helpful. Any suggestions will be extremely
appreciated.

Hi Johnny,

See http://word.mvps.org/FAQs/MacrosVBA/WordBasicCommands.htm, the
part about the DisableAutoMacros command.
 

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