WD: "WordBasic Err=25: Out of Memory (Stack Space)"

Last reviewed: February 2, 1998
Article ID: Q107796
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a

SYMPTOMS

When you run a macro in Word 7.x, the following error message appears:

   Winword caused an illegal operation (i.e. Winword caused an
   exception in module Kernel32.dll)

When you run a macro in Word 6.x, you get the error message:

   WordBasic Err=25: Out of Memory (Stack Space)

In Word 2.x for Windows, the error message is:

   WordBasic Err=7: Out of Memory

This problem does not occur in Word 97 for Windows or Word 98 Macintosh Edition for Windows.

CAUSE

Word 7.x is able to nest macros as deep as 15 levels. When it tries to open the 16th macro, it will return the error message. Word 2.x allows you to nest macros as deep as 11 levels. Word 6.x allows fewer than that. The actual amount varies, but it is typically between 6 and 9. This is because Word 6.x requires more overhead when calling a macro to account for the added functionality of passing array variables. This behavior is by design.

RESOLUTION

Word does NOT use as much overhead when calling subroutines within a macro. If you require nesting routines deeper than six levels, Microsoft recommends that you contain your functions within the same macro module.

MORE INFORMATION

The following is an example of a nested macro:

   Sub MAIN
      REM This macro is called Test1
      MsgBox "test1"
      Call test2
   End Sub

   Sub MAIN
      REM This macro is called Test2
      MsgBox "test2"
      Call test3
   End Sub

   Sub MAIN
      REM This macro is called Test3
      MsgBox "test3"
      Call test4
   End Sub

...continue until Test9 for Word 6 for Windows, Test12 for Word for Windows 2.x.


Additional query words: macro
Keywords : winword word7 word95 kberrmsg kbmacro
Version : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1
Platform : MACINTOSH WINDOWS
Issue type : kbprb
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.