Excel: FILES() Function Limited to 256 Filenames

Last reviewed: September 12, 1996
Article ID: Q99926
The information in this article applies to:
  • Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a, 5.0

SUMMARY

The FILES() function returns a horizontal array of the names of all files in a specified directory or folder. The number of filenames that this function can return is limited to a maximum of 256.

MORE INFORMATION

Although the FILES() function will not return more than 256 filenames at one time, you can use one of the following procedures to narrow the number of files the FILES() function searches for.

Specify the Type of File You Want to Find

You can specify which files you want the FILES() function to return. For example, FILES("C:\EXCEL\*.XLS") will return all files with an .XLS extension and FILES("C:\EXCEL\MAY*.XLS") will return all files that start with MAY and end with .XLS.

   Note: This method allows the FILES() function to create an array
   for each type of file you want a list for (provided the list of
   files does not exceed 256 names).

Categorize Files of Like Names in Separate Directories

You can categorize files into separate directories on the hard drive and then use the FILES() function to build a list of filenames for each directory.

REFERENCES

"Online Help," version 5.0 "Function Reference", version 4.0, page 147


KBCategory: kbusage
KBSubcategory:

Additional reference words: 3.0 3.00 4.0 4.00 4.0a 4.00a 5.0 5.00 limit
limitation



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: September 12, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.