Microsoft KB Archive/98971

-

{| The information in this article applies to:
 * width="100%"|
 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0b, 2.0c

SUMMARY
If you use a WordBasic dialog record repeatedly, Word may generate an &quot;Out of Memory&quot; error message.

Each command in Word has different properties that define parameters for that particular command. For example, .LeftIndent and .Bold are properties of the FormatCharacter command. The entire set of properties is referred to as a dialog record. When this dialog record is repeatedly assigned to a command, an &quot;Out of Memory&quot; error eventually results. This does not happen if the properties are explicitly assigned.

MORE INFORMATION
The following two macros illustrate this problem. Although these macros are functionally identical, Macro1 will cause an &quot;Out of Memory&quot; error while Macro2 will not. Macro1 should only be run with a single blank document open. You must restart Word to restore memory after you run the macro.

Macro1
Sub MAIN For I = 1 To 1000 Print Str$(I)             'Display the counter on the status bar Dim fc As FormatCharacter 'Declare dialog record fc   GetCurValues fc            'Get the current values FormatCharacter fc        'Assign them to FormatCharacter again Next End Sub

Macro2
Sub MAIN For I = 1 To 1000 Print Str$(I) Dim fc As FormatCharacter GetCurValues fc  FormatCharacter .Font = &quot;Times New Roman&quot;, .Points = &quot;12&quot;, \ .Bold = 0, .Italic = 0, .Strikeout = 0, .Hidden = 0, \ .SmallCaps = 0, .AllCaps = 0, .Underline = 0, .Color = 0, \ .Position = &quot;0 pt&quot;, .Spacing = &quot;0 pt&quot; Next End Sub
 * }

-

Last reviewed: July 30, 1997

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.