View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jorge Ribeiro Jorge Ribeiro is offline
external usenet poster
 
Posts: 13
Default VSTO unable to rename worksheet

Hello

I'me trying to rename several worksheets with the folowing code.
When my worksheets are visible the renaming process throws an exception

Excel.worksheet sheet = ...

string oldName = sheet.Name;
Excel.XlSheetVisibility visibility = sheet.Visible;
// change name
sheet.Visible =
Microsoft.Office.Interop.Excel.XlSheetVisibility.x lSheetVisible;
string newName = name + node.Attributes["suffix"].Value;
sheet.Name = newName;
sheet.Visible = visibility;

the newName string is well formed and my code only breaks at instruction
sheet.Name = newName; (error 0x800A03EC...)
it all goes well when my sheet is originally veryhidden.
when it is visible it sends an error

i'me running out of ideas.. can anyone help me

best regards

Jorge