Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default VSTO unable to rename worksheet

SOLVED:

I first have to unprotect workbook structure...

thanx anyway

"Jorge Ribeiro" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VSTO Excel with Autoshapes, Connectors and Polylines on Worksheet? theophan Excel Programming 3 March 24th 08 08:26 PM
No Worksheet Range Object in VSTO? Wei Lu [MSFT] Excel Programming 1 January 22nd 07 10:54 AM
No Worksheet Range Object in VSTO? NickHK Excel Programming 0 January 18th 07 05:58 AM
Why would you be unable to rename an unprotected worksheet? LBORDERS Excel Discussion (Misc queries) 2 August 17th 06 12:46 AM
VSTO .net - Adding a Usercontrol unto Worksheet pxiong Excel Programming 0 February 13th 04 08:07 PM


All times are GMT +1. The time now is 10:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"