ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I delete a worksheet from the workbook. (https://www.excelbanter.com/excel-programming/317540-how-can-i-delete-worksheet-workbook.html)

Michael Tkachev

How can I delete a worksheet from the workbook.
 
Hi everybody,

I'm creating an appliction in the C#. This application is working with
excel. I could do a lot of things there. But I couldn't remove a worksheet
from the workbook. How can I do it
I wrote the following code below:

ApplicationClass ac = new ApplicationClass();
Workbook wb = ac.Workbooks["Book1.xls"];

.... // code

((Worksheet)wb.Sheets["Sheet2"]).Delete();

The "Delete" method doesn't work. What's wrong here? Who knows how I can do
it?

Thank you very much.

--
Sincerely yours,
Michael Tkachev.
..Net Developer




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

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