Cuando intento configurar un nombre de hoja alargada usando rubí y win32ole con el siguiente código:¿Existe un límite en la longitud del nombre de una hoja de cálculo de Excel?
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
me sale el siguiente:
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 `<main>'
La versión 12.0 indica que estoy ejecutando Excel 2007 , pero se queja de que el nombre de la hoja de trabajo es demasiado largo. Eché un vistazo a Excel 2007 specifications and limits como se menciona en this related answer, y no pude encontrarlo mencionando dicho límite. (Intentar cambiar el nombre de una hoja de cálculo manualmente sugiere que puede haber tal límite, sin embargo)
¿Existe un límite, y es un límite difícil o uno que se puede cambiar cambiando la configuración de Excel?
https://excelibrib.tips.net/T013175_Using_Very_Long_Worksheet_Tab_Names.html puede ser de interés, aunque no reciente. – pnuts