XL: "Filename Is Not Valid" Error Saving or Opening File

Last reviewed: April 14, 1997
Article ID: Q131464
The information in this article applies to:
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel 97 for Windows

SYMPTOMS

When you open or save a file in Microsoft Excel, you may receive one of the following error messages:

   Filename is not valid

   -or-

   The file could not be accessed.

   -or-

   The path you entered, '<filename>', is too long. Enter a shorter path.

CAUSE

This error message occurs when you save or open a file if the path to the file (including the filename) exceeds 219 characters. This limitation includes three characters for the drive, the characters in folder names, the backslash character between folders, and the filename itself.

This behavior is based on a 256-character limitation for creating links to another file. This limit is by design in Microsoft Excel because of the way that Microsoft Excel uses the filename internally. This behavior limits the path name to 219 characters. This limit of 219 characters for the path name is based on the following:

  • Up to 31 characters in a sheet name
  • Apostrophes and brackets used to denote the workbook name
  • An exclamation point
  • A cell reference

For example, the path for a file in Microsoft Excel for Windows might be:

   'c:\excel\personal\...\[my workbook.xls]up_to_31_char_sheetname'!$A$1

RESOLUTION

To avoid receiving this error message when you open or save a file in Microsoft Excel, make sure that the path to the file contains fewer than 219 characters. You can do this by doing any of the following:

  • Rename the file so that it has a shorter name.

    -or-

  • Rename the folder(s) that contain the file so that they have shorter names.

    -or-

  • Move the file to a folder with a shorter path name.

MORE INFORMATION

Microsoft Excel

Note that in the File Name box in the Save As dialog box, you can type up to 255 characters. However, when you click OK to save the file, you receive the following error message

   The path '<filename>' exceeds 255 characters.

and you cannot save the file. When you save a file in Microsoft Excel, if the number of characters in the file path exceeds 255, the Microsoft Windows limit, then you receive the "path exceeds 255 characters" error message instead of the "filename is not valid" error message.

Windows 95

In Microsoft Windows version 95, the limitation for the path name for a file is 255 characters. When you rename a file in Explorer or My Computer, you are unable to type more characters when you reach the 255 character limit for the path to the file.

If you move a file to a subfolder where the path would exceed 255 characters, you receive the following error message:

   Cannot move <filename>: the filename you specified is invalid or too
   long. Specify a different filename.


Additional query words: 7.00 8.00 97 XL97 218
Keywords : xlloadsave xlwin kberrmsg kbother
Version : 7.00 97
Platform : WINDOWS


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