Out of string space (Error 14)

This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.

Visual Basic permits you to use very large strings. However, the requirements of other programs and the way you manipulate your strings may cause this error. This error has the following causes and solutions:

  • Expressions requiring that temporary strings be created for evaluation may cause this error. For example, the following code causes an Out of string space error on some operating systems:

    MyString = "Hello" 
    For Count = 1 To 100 
    MyString = MyString & MyString 
    Next Count 
    

    Assign the string to a variable of another name.

  • Your system may have run out of memory, which prevented a string from being allocated. Remove any unnecessary applications from memory to create more space.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).