"WordBasic Err=7: Out of Memory" with More Than 5 Nested Subs

Last reviewed: October 10, 1997
Article ID: Q101432
The information in this article applies to:
  • Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c

SUMMARY

You cannot nest subroutines or functions more than five levels deep in a Word for Windows WordBasic macro. If you call a subroutine that is nested five or more levels deep, the following WordBasic error message occurs:

   WordBasic Err=7
   Out Of Memory

This happens because the WordBasic macro interpreter cannot call more than five subroutine levels. It is not a Word for Windows limitation.

For example, the following macro causes the above error message when it calls a subroutine nested six levels deep:

Sub MAIN
   Nest1
End Sub

Sub Nest1
   MsgBox "Made It To Nest 1"
   Nest2
End Sub

Sub Nest2
   MsgBox "Made It To Nest 2"
   Nest3
End Sub

Sub Nest3
   MsgBox "Made It To Nest 3"
   Nest4
End Sub

Sub Nest4
   MsgBox "Made It To Nest 4"
   Nest5
End Sub

Sub Nest5
   MsgBox "Made It To Nest 5"
   Nest6
End Sub

Sub Nest6
   MsgBox "Made It To Nest 6"
End Sub

STATUS

Microsoft has confirmed this to be a problem in the versions of Microsoft Word for Windows listed above. This problem was corrected in Word version 6.0 for Windows.

To obtain new or updated Microsoft products, call the Microsoft Sales Information Center at (800) 426-9400. If you are outside the United States, contact the Microsoft subsidiary for your area. To locate your subsidiary, call Microsoft International Customer Service at (425) 936-8661.


KBCategory: kbmacro
KBSubcategory:
Additional query words: 1.0 1.10 1.10a 2.0 2.0a 2.0a-CD 2.0b
winword2 winword 2.0c


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: October 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.