How to delete a sheet from workbook

I

Ivan

Hello,

How can I delete (remove) the sheet from the workbook. I tried to use Delete
method of the Worksheet object, but it displayed an confirmation dialog and I
don't know, how to switch it off.

Any suggestions?

Thanks.
 
D

Dick Kusleika

Ivan

Application.DisplayAlerts = False
ThisWorkbook.Worksheets(1).Delete
Application.DisplayAlerts = True
 
G

gilmar

Hi,
I tried using this:
app.DisplayAlerts = false;
((xlWorkbook.Worksheets["Sheet1"] as Worksheet)).Delete();
app.DisplayAlerts = true;

But it resulted to:
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

How can I resolve this error and successfully delete Sheet1?

thanks and regards
gilmar
 
O

Oliver Bock

I have had this error code when the Excel process is killed while I am
telling it to do something.
 

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

Top