title: Is there a limit on an Excel worksheet's name length?
body: <p>When I try to set a longish worksheet name using ruby and win32ole with the following code:</p>
  
  <pre><code>require "win32ole"
  excel = WIN32OLE.new('Excel.Application')
  excel.Visible = 1
  puts excel.version
  workbook = excel.Workbooks.Add
  worksheet1 = workbook.Worksheets.Add
  worksheet1.Name = "Pseudopseudohypoparathyroidism" #Length 30, fine
  worksheet2 = workbook.Worksheets.Add
  worksheet2.Name = "Supercalifragilisticexpialidocious" #Length 34, not fine
  </code></pre>
  
  <p>I get the following:</p>
  
  <pre><code>12.0
  -:9:in `method_missing': (in setting property `Name': ) (WIN32OLERuntimeError)
      OLE error code:800A03EC in Microsoft Office Excel
        You typed an invalid name for a sheet or chart. Make sure that:
  
   The name that you type does not exceed 31 characters.
   The name does not contain any of the following characters:  :  \  /  ?  *  [  or  ]
   You did not leave the name blank.
      HRESULT error code:0x80020009
        Exception occurred.
          from -:9:in `&lt;main&gt;'
  </code></pre>
  
  <p>The version 12.0 indicates that I'm running Excel 2007, but it's complaining that the worksheet name is too long. I had a look at <a href="http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP005199291.aspx" rel="noreferrer">Excel 2007 specifications and limits</a> as mentioned in <a href="https://stackoverflow.com/questions/644429/what-is-excel-2007-workbook-name-size-limit-why/650478#650478">this related answer</a>, and I couldn't find it mentioning any such limit. (Trying to rename a worksheet manually suggests there may be such a limit, however)</p>
  
  <p>Is there a limit, and is it a hard limit or one that can be changed by changing the configuration of Excel?</p>