none
Using extensibility, open a macro template without running any auto code inside the template RRS feed

  • Question

  • Hi.  I am building a project that reads through many Dotm (Word 2010) templates and outputs the code for version control and code compare.  I have an issue with templates that have on open events or autoexec modules.  I am opening the templates this way:

     Set doc = Documents.Open(strFullName, ReadOnly:=True)

    Is there a way to open them in a way that nothing inside will run?  Something similar to the '/A' administrative parameter when running WinWord from the command line?

    Thanks

    Ken


    • Edited by kbax Friday, April 27, 2012 5:38 PM
    Friday, April 27, 2012 5:37 PM

Answers

  • Other office applications have a parameter that lets you open a document and to not run any auto macros. Word doesn't appear to have one (I looked in the Object Browser for Word 2010).

    I would edit the macro so that it tests the active document name and if it has a .dot or .dotx at the end of the name then exit. Now the macro will still run, but it won't do anything.

    Hopefully a Word VBA person will provide an even easier answer!


    Rod Gill

    The one and only Project VBA Book

    Rod Gill Project Management

    • Marked as answer by kbax Monday, April 30, 2012 5:27 PM
    Friday, April 27, 2012 10:38 PM

All replies