ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem Naming Worksheet (https://www.excelbanter.com/excel-programming/365868-problem-naming-worksheet.html)

[email protected]

Problem Naming Worksheet
 
I have a C# program accessing the Excel interop. No matter what I do,
I can't get the name of the active worksheet to change from "Sheet1".
Here's basically the code.

MSExcel.Application xlApp = null;
MSExcel._Workbook wkb = null;
MSExcel._Worksheet wks = null;
string sheetName = "Opportunites";

xlApp = new MSExcel.Application();
wkb = xlApp.Workbooks.Add(MSExcel.XlWBATemplate.xlWBATWo rksheet);
wks = (MSExcel._Worksheet) wkb.ActiveSheet;
wks.Name = sheetName;

Is there anything else I need to do?


[email protected]

Problem Naming Worksheet
 
I should have added that when I look at the worksheet name in the
debugger, it does appear as "Opportunities". However, when Excel is
made visible, the sheet name is still named "Sheet1".

wrote:
I have a C# program accessing the Excel interop. No matter what I do,
I can't get the name of the active worksheet to change from "Sheet1".
Here's basically the code.

MSExcel.Application xlApp = null;
MSExcel._Workbook wkb = null;
MSExcel._Worksheet wks = null;
string sheetName = "Opportunites";

xlApp = new MSExcel.Application();
wkb = xlApp.Workbooks.Add(MSExcel.XlWBATemplate.xlWBATWo rksheet);
wks = (MSExcel._Worksheet) wkb.ActiveSheet;
wks.Name = sheetName;

Is there anything else I need to do?




All times are GMT +1. The time now is 04:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com