Length of worksheet name

H

Howard Kaikow

Is there a property, or registry entry, that specifies the maximum length of
a worksheet name?
 
H

Howard Kaikow

Tom Ogilvy said:
I believe the built in (unalterable) limitation is 31 characters.

Ayup, I also believe that, but I'd rather not hard code the value, in case
the value changes for future versions.
 
T

Tom Ogilvy

Perhaps if they make it longer, they will offer something you can check
programmatically. Right now, I don't believe there is.
 
H

Howard Kaikow

Tom Ogilvy said:
Perhaps if they make it longer, they will offer something you can check
programmatically. Right now, I don't believe there is.

Ayup, that's a design flaw in MSFT's thinking.
Such critters ALL need to made into properties or registry settings from day
1.
Does no good to have the property in later versions as the critter won't
work in previous versions.
 
D

Dave Peterson

If you're trying to catch possible errors before a rename, maybe you could just
try it and check for an error:

dim myNewName as string
mynewname = inputbox(prompt:="new name?")
if trim(mynewname) = "" then
exit sub
end if

with activesheet
on error resume next
.name = myNewName
if err.number <> 0 then
'something went wrong--maybe the length, maybe something else
msgbox "not renamed!
err.clear
end if
on error goto 0
end with

There are lots of other things that cause rename errors besides the length of
the suggested new 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