View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Michael Tkachev Michael Tkachev is offline
external usenet poster
 
Posts: 1
Default 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