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

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 : kberrmsg kbmacro winword word7 word95
Version : MACINTOSH:6.0,6.0.1,6.0.1a; WINDOWS:6.0,6.0a,6.0c,7.0,7.0a
Platform : MACINTOSH WINDOWS
Issue type : kbprb


Last Reviewed: September 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.