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

ID: Q101432

The information in this article applies to:

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

Last Reviewed: October 10, 1997