Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
custom alert message Jim Hunt Excel Discussion (Misc queries) 3 January 1st 08 11:49 PM
Message alert laurenm Excel Discussion (Misc queries) 6 December 19th 06 08:05 PM
Alert Message In need of help! Excel Discussion (Misc queries) 1 November 17th 06 01:04 PM
What is the VBA code to delete a sheet without warning message? [email protected] Excel Discussion (Misc queries) 2 August 9th 05 04:16 PM
MESSAGE ALERT Shyla Excel Programming 2 October 28th 03 08:54 PM


All times are GMT +1. The time now is 04:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"