0 votes
in VBA by Beginner (2 points)
Does the list file path macro list file paths greater than 250 characters?

If not, is it possible to do this?

1 Answer

0 votes
by Super Expert (3.2k points)

The FSO macro to list files in a folder doesn't work for file paths beyond a certain length, but the macro in our tutorial on Looping through Files in a Folder with VBA allows it. Because it doesn't actually open the files so it ought to work for you. By default, it lists the files in the immediate window, but you can modify the code to list files in your Excel workbook by replacing

        Debug.Print file


        i = i + 1
        Range("A" & i) = strDir & file


Welcome to wellsr Q&A
wellsr Q&A is the VBA and Python programming community that rewards you for learning how to code.

Getting Started
VBA Cheat Sheets (On Sale Now)

Earn free prizes for asking VBA and Python questions and for answering questions asked by others in our community.

Looking for something else? Hire our professional VBA Help, instead.

What makes us different?
Our points system rewards you with a chance for free gifts based on the quality of your questions and answers. All you have to do is post and you could get rewarded, like these members:

ParserMonster $25 Amazon Gift Card
Hightree $10 Amazon Gift Card
Thales1 $10 Amazon Gift Card
runfunke $10 Amazon Gift Card
coolag $10 Amazon Gift Card
Siew Hun $10 Amazon Gift Card

So, why don't you join us? It really is an encouraging way to motivate members in our VBA and Python community.


For more programming tips visit the VBA Tutorials Blog and the Python Tutorials Blog.