Unable to delete a worksheet in a workbook.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I try to delete a worksheet in a workbook using .Delete() method of the
worksheet object. When I run the program nothing happens.

Can any one point to me how to delete a worksheet in a workbook using Excel
object?

Please see below for my working environment.

Platform:
..NET 1.1 program references MS Excel 11 library.
MS Office 2003.

Thanks
D. Santhosh
 
Hi Dales,

Below is my code to delete "Sheet1" worksheet in my workbook.

With DirectCast(ThisWorkBook.Sheets("Sheet1"), Excel.Worksheet)
.Select()
.Delete()
End With

Thanks
D. Santhosh
 
Hi Rowan,

I tried "ThisWorkbook.Sheets("Sheet1").Delete". It does not seem to work.

Thanks,

D. Santhosh
 
In what way does it not work? Are you getting an error message? Is the
sheet still there after you run the code? Etc etc?

Regards
Rowan
 
Back
Top