Filename length in Excel limited to 92 characters

P

PARaine

Is the filename length in Excel (office XP) limited to 92 characters? I have
found this limitation today and do not no whether it is a bug or not.
 
J

Jimbola

Just tried this, I can easily go beyond 100 as the file name. Could be a
specific set-up on you ur machine.
Out of curiosity how does one end up finding that out? Are gonna save a
filename with more than 100 letters? if so why...what would the file be
called. (Totally curious here)

J
 
D

Dave Peterson

I use xl2003 (but I don't think there's been a change since windows 95/xl95).

I ran this to test it.

Option Explicit
Sub testme()

Dim myStr As String
Dim iCtr As Long

For iCtr = 100 To 1000
myStr = "C:\my documents\excel\test\" & String(iCtr, "A") & ".xls"
On Error Resume Next
ThisWorkbook.SaveCopyAs Filename:=myStr
If Err.Number <> 0 Then
Debug.Print "Blew up when ictr = " & iCtr _
& "--and length was: " & Len(myStr)
Exit Sub
End If
Kill myStr
Next iCtr

End Sub

I got this back:

Blew up when ictr = 188--and length was: 219

So my guess is that the filename was 92 characters, but the folder where you
saved the file extended the fullname of the file to 219 characters.

Am I close?
 
R

RWN

This, from Help in w2kpro ("File Names" -> "Changing"");
a.. A file name can contain up to 215 characters, including spaces. However, it is not
recommended that you create file names with 215 characters. Most programs cannot interpret
extremely long file names. File names cannot contain the following characters:
\ / : * ? " < > |

I believe that the "File Name" referred to implies the full path as well as the actual
file name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top