
deleting worksheet in excel workbook
Sanjeev
Try this
appExcel.DisplayAlerts = False
bookExcel.Sheets(2).Delete
appExcel.DisplayAlerts = True
Setting DisplayAlerts to False will force Excel to accept the default button
on most dialog boxes. The default for deleting a sheet is OK, so that
should work good for your situation.
--
{*filter*} Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.
Quote:
> Hi
> i am using following code to delete a worksheet in excel workbook
> Set appExcel = CreateObject("Excel.Application")
> filePath = "C:\temp\testBook.xls"
> set bookExcel = appExcel.Workbooks.Open(filePath, ,false)
> bookExcel.Sheets(2).Delete
> Problem:
> It pops up a Msg box
> [
> "Selected sheet will be permanently deleted"
> Click ok to delete]
> How can i avoid or by pass this msgbox?
> while adding worksheet it does not asks anything.it simply adds
> worksheet
> thanks
> Sanjeev
> --
> Posted via http://www.*-*-*.com/