PDA

View Full Version : Open a workbook with a long file path



alan_ay
06-24-2010, 01:07 AM
Hi all,

I want to open a workbook with a long filename in macro.
e.g. C:\00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000220.csv
It is one filename.

However, I can't open the workbook. Is excel has limits on the length of the filename?

Thanks & Regards,
alan

p45cal
06-24-2010, 02:33 AM
Could you show me the line where it's failing?

p45cal
06-24-2010, 03:07 AM
On mine there seems to be a limit of 218 characters, path'n'all. (I presume that the file hasn't really got this ridiculous filename, but the path is just as long.)
I remember having a long path like this when trying to open files when I contracted for a large telco and the only solution was to move the files to a location with a shorter path.
Another solution might be to map a directory to a drive letter on your machine, perfectly OK if you're the only one handling these long-pathed files.

alan_ay
06-24-2010, 06:23 PM
Thank you.

After I shorten the filename, the file can be opened. It suggest that it is the limit problem.

Is there any method to remove this limit?

p45cal
06-25-2010, 12:49 AM
I doubt it.

aliceten
11-27-2013, 09:56 PM
You can use Long Path Tool as well, it is the perfect solutions to such issues!

snb
11-28-2013, 10:37 AM
Sub M_snb()
workbooks.open CreateObject("scripting.filesystemobject").GetFile("G:\OF\adressen.xls").ShortPath
End Sub