Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Suppress worksheet delete verification msgbox

I have a workbook that creates new worksheets using a template worksheet and
a data worksheet (kind of like a Word mailmerge). An index worksheet is also
updated with the names of the created worksheets and hyperlinks to them.
When I want to clear the workbook, I loop through the index worksheet
calling the following macro that deletes the created worksheets. I also
delete entries in the index.

Sub Remove_Worksheet(WorksheetName As String)
Sheets(WorksheetName).Select
ActiveWindow.SelectedSheets.Delete
End Sub

This macro works fine, but a verification message is displayed each time a
worksheet is to be deleted.

Data may exist in the sheet(s) selected for deletion. To permanently delete
the data, press Delete.

Delete Cancel

I was wondering if there is a command that will prevent this message box
from being displayed and allow the worksheet to be deleted without requiring
an individual user provided response for each one? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,089
Default Suppress worksheet delete verification msgbox

Application.DisplayAlerts = False
;
your code
;
Application.DisplayAlerts = True

Regards

Trevor


"CurtB" wrote in message
...
I have a workbook that creates new worksheets using a template worksheet
and
a data worksheet (kind of like a Word mailmerge). An index worksheet is
also
updated with the names of the created worksheets and hyperlinks to them.
When I want to clear the workbook, I loop through the index worksheet
calling the following macro that deletes the created worksheets. I also
delete entries in the index.

Sub Remove_Worksheet(WorksheetName As String)
Sheets(WorksheetName).Select
ActiveWindow.SelectedSheets.Delete
End Sub

This macro works fine, but a verification message is displayed each time a
worksheet is to be deleted.

Data may exist in the sheet(s) selected for deletion. To permanently
delete
the data, press Delete.

Delete Cancel

I was wondering if there is a command that will prevent this message box
from being displayed and allow the worksheet to be deleted without
requiring
an individual user provided response for each one? Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Suppress worksheet delete verification msgbox

Thanks, Trevor.

"Trevor Shuttleworth" wrote:

Application.DisplayAlerts = False
;
your code
;
Application.DisplayAlerts = True

Regards

Trevor


"CurtB" wrote in message
...
I have a workbook that creates new worksheets using a template worksheet
and
a data worksheet (kind of like a Word mailmerge). An index worksheet is
also
updated with the names of the created worksheets and hyperlinks to them.
When I want to clear the workbook, I loop through the index worksheet
calling the following macro that deletes the created worksheets. I also
delete entries in the index.

Sub Remove_Worksheet(WorksheetName As String)
Sheets(WorksheetName).Select
ActiveWindow.SelectedSheets.Delete
End Sub

This macro works fine, but a verification message is displayed each time a
worksheet is to be deleted.

Data may exist in the sheet(s) selected for deletion. To permanently
delete
the data, press Delete.

Delete Cancel

I was wondering if there is a command that will prevent this message box
from being displayed and allow the worksheet to be deleted without
requiring
an individual user provided response for each one? Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Suppress worksheet delete verification msgbox

This works fine, but what if I do NOT want a user to be able to delete a
worksheet (by right-clicking the sheet tab, then click delete). How can I
capture the event that a user right clicks a worksheet tab ? The
'beforerightclick' event works all over the sheet, but except for the tab. Do
I have to set 'Target' to a secret 'range' ?

"CurtB" wrote:

I have a workbook that creates new worksheets using a template worksheet and
a data worksheet (kind of like a Word mailmerge). An index worksheet is also
updated with the names of the created worksheets and hyperlinks to them.
When I want to clear the workbook, I loop through the index worksheet
calling the following macro that deletes the created worksheets. I also
delete entries in the index.

Sub Remove_Worksheet(WorksheetName As String)
Sheets(WorksheetName).Select
ActiveWindow.SelectedSheets.Delete
End Sub

This macro works fine, but a verification message is displayed each time a
worksheet is to be deleted.

Data may exist in the sheet(s) selected for deletion. To permanently delete
the data, press Delete.

Delete Cancel

I was wondering if there is a command that will prevent this message box
from being displayed and allow the worksheet to be deleted without requiring
an individual user provided response for each one? Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 68
Default Suppress worksheet delete verification msgbox

When that workbook opens (in the workobook_open Event):
Private Sub Workbook_Open()
Application.CommandBars("Ply").Controls("Delete"). Enabled = False
End Sub

and before that workbook closes:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Ply").Reset
End Sub

maybe also include this:
Private Sub Workbook_Activate()
Application.CommandBars("Ply").Controls("Delete"). Enabled = False
End Sub

HTH

"nb0512" wrote in message
...
This works fine, but what if I do NOT want a user to be able to delete a
worksheet (by right-clicking the sheet tab, then click delete). How can I
capture the event that a user right clicks a worksheet tab ? The
'beforerightclick' event works all over the sheet, but except for the tab.
Do
I have to set 'Target' to a secret 'range' ?

"CurtB" wrote:

I have a workbook that creates new worksheets using a template worksheet
and
a data worksheet (kind of like a Word mailmerge). An index worksheet is
also
updated with the names of the created worksheets and hyperlinks to them.
When I want to clear the workbook, I loop through the index worksheet
calling the following macro that deletes the created worksheets. I also
delete entries in the index.

Sub Remove_Worksheet(WorksheetName As String)
Sheets(WorksheetName).Select
ActiveWindow.SelectedSheets.Delete
End Sub

This macro works fine, but a verification message is displayed each time
a
worksheet is to be deleted.

Data may exist in the sheet(s) selected for deletion. To permanently
delete
the data, press Delete.

Delete Cancel

I was wondering if there is a command that will prevent this message box
from being displayed and allow the worksheet to be deleted without
requiring
an individual user provided response for each one? Thanks.




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Suppress worksheet delete verification msgbox

Thanks Bob ! Works fine.

"Bob Umlas" wrote:

When that workbook opens (in the workobook_open Event):
Private Sub Workbook_Open()
Application.CommandBars("Ply").Controls("Delete"). Enabled = False
End Sub

and before that workbook closes:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Ply").Reset
End Sub

maybe also include this:
Private Sub Workbook_Activate()
Application.CommandBars("Ply").Controls("Delete"). Enabled = False
End Sub

HTH

"nb0512" wrote in message
...
This works fine, but what if I do NOT want a user to be able to delete a
worksheet (by right-clicking the sheet tab, then click delete). How can I
capture the event that a user right clicks a worksheet tab ? The
'beforerightclick' event works all over the sheet, but except for the tab.
Do
I have to set 'Target' to a secret 'range' ?

"CurtB" wrote:

I have a workbook that creates new worksheets using a template worksheet
and
a data worksheet (kind of like a Word mailmerge). An index worksheet is
also
updated with the names of the created worksheets and hyperlinks to them.
When I want to clear the workbook, I loop through the index worksheet
calling the following macro that deletes the created worksheets. I also
delete entries in the index.

Sub Remove_Worksheet(WorksheetName As String)
Sheets(WorksheetName).Select
ActiveWindow.SelectedSheets.Delete
End Sub

This macro works fine, but a verification message is displayed each time
a
worksheet is to be deleted.

Data may exist in the sheet(s) selected for deletion. To permanently
delete
the data, press Delete.

Delete Cancel

I was wondering if there is a command that will prevent this message box
from being displayed and allow the worksheet to be deleted without
requiring
an individual user provided response for each one? Thanks.


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
Date verification Oldjay Excel Discussion (Misc queries) 4 October 24th 06 03:52 AM
how do I suppress printing blank lines in a worksheet? Rob M'Crystal Excel Discussion (Misc queries) 1 October 12th 06 03:14 PM
data verification question James Excel Worksheet Functions 0 August 2nd 06 07:44 PM
data verification Kristen Excel Discussion (Misc queries) 0 July 14th 06 02:31 PM
If a worksheet name is = to test then a msgbox appears Vick Excel Discussion (Misc queries) 1 December 21st 05 11:17 PM


All times are GMT +1. The time now is 10:26 AM.

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

About Us

"It's about Microsoft Excel"