delete sheet in excel

  • Thread starter Thread starter Bas
  • Start date Start date
B

Bas

I',m trying to delete a named worksheet - what's wrong with this??
xlApp = New Excel.Application()
Dim xWorkbook As Excel.Workbook
Dim PageSht As Excel.Worksheet
xWorkbook = xlApp.Workbooks.Open("Test.xls")
Dim pageWkSht As Excel.Worksheet
pageSht = xWorkbook.Sheets("Page")
pageSht.Delete()

No error is generated and the sheet is NOT deleted
 
Hi,
I',m trying to delete a named worksheet - what's wrong with this??
xlApp = New Excel.Application()
Dim xWorkbook As Excel.Workbook
Dim PageSht As Excel.Worksheet
xWorkbook = xlApp.Workbooks.Open("Test.xls")
Dim pageWkSht As Excel.Worksheet
pageSht = xWorkbook.Sheets("Page")
pageSht.Delete()

No error is generated and the sheet is NOT deleted

have you tried ..
xWorkbook.Sheets("Page").Delete()
...?

Cheers,
Olaf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top