Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to delete a sheet without Alert message
I use a VBS script to open a excel file and delete the sheets based o some condition and Save and then close it. The sampe script is Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True On Error Resume Next objExcel.workbooks.open "D:\FIPackageNEW.xls" For Each ws In objExcel.Worksheets If not ws.Name = "Sheet1" Then ws.delete End If Next objExcel.Save objExcel = Nothing objExcel.quit I am getting a message (Data may exists in the sheet(s) selected fo deletion. To premanently delete the data, press Delete) when i run thi script. How to avoid this. There should not be any alert message whil deleting the sheets. Thanks in advance __________________ Kalyana Venkatesh Eagle Consulting -- kvenk I am VB programme ----------------------------------------------------------------------- kvenku's Profile: http://www.excelforum.com/member.php...nfo&userid=742 View this thread: http://www.excelforum.com/showthread.php?threadid=56280 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to delete a sheet without Alert message
Put Application.DisplayAlerts = False in the macro somewhere before the "ws.delete" line. This will suppres any messages (Excel will automatically use the default). Co -- colofnatur ----------------------------------------------------------------------- colofnature's Profile: http://www.excelforum.com/member.php...fo&userid=3435 View this thread: http://www.excelforum.com/showthread.php?threadid=56280 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to delete a sheet without Alert message
Just a caution that this will not work (when issued from an automation
client) in some versions of excel - possibly xl2000 and earlier. -- Regards, Tom Ogilvy "colofnature" wrote: Put Application.DisplayAlerts = False in the macro somewhere before the "ws.delete" line. This will suppress any messages (Excel will automatically use the default). Col -- colofnature ------------------------------------------------------------------------ colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356 View this thread: http://www.excelforum.com/showthread...hreadid=562809 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
custom alert message | Excel Discussion (Misc queries) | |||
Message alert | Excel Discussion (Misc queries) | |||
Alert Message | Excel Discussion (Misc queries) | |||
What is the VBA code to delete a sheet without warning message? | Excel Discussion (Misc queries) | |||
MESSAGE ALERT | Excel Programming |