• Opening a file without running macros (Word 2003)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Opening a file without running macros (Word 2003)

    Author
    Topic
    #445552

    Could somebody please remind me how to do this? It seems to be the only way to debug a baffling problem, and I can’t find the documentation for it.

    Viewing 0 reply threads
    Author
    Replies
    • #1080633

      You can defeat the Auto____ macros by holding the Shift key until the document has launched and settled down. Did you want to block other types of macros as well? In that case it might be easiest to change the Macro Security level, close and restart Word.

      • #1080828

        Thanks; that works. There is no need to suppress other macros because this is a debugging situation. Something in the Document_Open macro is making Word crash (“Microsoft Word has encountered an error and must close”), most but not all of the time. I just need to open the document without running the macro so that I can step through it.

        I’m now waiting for the problem to recur so that I have something to debug!

        • #1081070

          >”Microsoft Word has encountered an error and must close”
          It may not be a bug in your code.
          My best success at resolving this problem is to reconstruct the template completely:

          1. Save a new version
          2. Run Rob Bovey’s VBA Code Clenaer on the new version, (Options: Do NOT delete exported files, save them to a fresh folder).
          3. Close the file.
          4. Create a new template, save it with a name.
          5. Import the exported files (BAS/CLS/FRM etc.) to the new template.
          6. Rebuild the toolbar (if any)
          7. Reset the project properties (name, help file, protection etc.).

          If I had to bet, I’d bet that the corruption occurred after a change to a graphic element, e.g. a tioolbar or a GUI form.

          • #1081089

            I suspect you’re right that it’s not a bug in my code. I thought that stepping through the code to find the point of failure would give me a clue to the cause (or at any rate, that nothing else would). Your suggestion sounds promising, and when the problem recurs I will try it.

            It’s interesting that you mention toolbars, because for about as long as I have had this problem, the application’s user-defined toolbars have been disappearing spontaneously. (They disappear when a window is deactivated, then activated again.) I have been living with that problem because I don’t have time to fix it, but it never occurred to me that the two problems were connected.

            • #1081106

              > the application’s user-defined toolbars have been disappearing spontaneously.
              I think that the bug I’m referring to is some form of corruption. I feel that it arises when i have dragged something to/from the toolbar when I maybe shouldn’t have – perhaps while a running macro is paused or interrupted.
              There is (to my mind) another bug regarding toolbars whereby the user-defined toolbar for that application persists when I Alt-Tab to the VBE, and if I click on the toolbar, then Alt-Tab back to the VBE, the toolbar stays hidden (as it ought being part of the application).

              Anyway, chances are that stepping through your code will not reveal any flaw on your part, but rebuilding the template (say 15 minutes) will cause the problem to disappear.

              For the time being (grin!)

    Viewing 0 reply threads
    Reply To: Opening a file without running macros (Word 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: