Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Prevent deleting spreadsheet

Is there a way to prevent a userfrom deleting a single spreadsheet? I don't
want to lock down the whole workbook, but I would like to protect one
worksheet in the workbook. I was looking for something like:

Sub Worksheet_BeforeDelete (lgDelete as Boolean)

But of course, no such option exist. Any help will be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Prevent deleting spreadsheet

If you don't want to use workbook protection, then I don't think you can stop it
or catch it.

But you could use some other event to (Workbook_SheetSelectionChange???) to look
for it. If it's gone, give that user a severe chastising.

Or ...maybe... keep a hidden copy of the worksheet and just recreate that just
deleted worksheet. (This may not help--if you have formulas in other sheets
that refer to that worksheet, it'll be too late.)



JR_06062005 wrote:

Is there a way to prevent a userfrom deleting a single spreadsheet? I don't
want to lock down the whole workbook, but I would like to protect one
worksheet in the workbook. I was looking for something like:

Sub Worksheet_BeforeDelete (lgDelete as Boolean)

But of course, no such option exist. Any help will be greatly appreciated.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Prevent deleting spreadsheet

Your idea sounds promising, esepecially about recreating the sheet. It
doesn't have any connecting formulas. In fact all it is is a message for
users when they disable the macro feature. The workbook is locked and the
only spreadsheet visible is the one with the message. However, when macros
are enabled, there is nothing to keep the curious user from making the
message spreadsheet visible and deleting it.

So I have a follow-up question. Is there a way to see if a particular
worksheet exist? On the Workbook Before Close event, I could test to sheet
if the worksheet exist and if not, recreate it.

Thanks for your suggestions.

"Dave Peterson" wrote:

If you don't want to use workbook protection, then I don't think you can stop it
or catch it.

But you could use some other event to (Workbook_SheetSelectionChange???) to look
for it. If it's gone, give that user a severe chastising.

Or ...maybe... keep a hidden copy of the worksheet and just recreate that just
deleted worksheet. (This may not help--if you have formulas in other sheets
that refer to that worksheet, it'll be too late.)



JR_06062005 wrote:

Is there a way to prevent a userfrom deleting a single spreadsheet? I don't
want to lock down the whole workbook, but I would like to protect one
worksheet in the workbook. I was looking for something like:

Sub Worksheet_BeforeDelete (lgDelete as Boolean)

But of course, no such option exist. Any help will be greatly appreciated.


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Prevent deleting spreadsheet

First, I wouldn't use the _beforeclose event. The workbook would have to saved
to include that change--and if the user actually wanted to discard other
changes, you might be messing them up.

But you could use workbook_beforesave, maybe...

dim wks as worksheet
set wks = nothing
on error resume next
set wks = me.worksheets("warningmessagesheet")
on error goto 0

if wks is nothing then
'recreate it
else
'already there
end if



JR_06062005 wrote:

Your idea sounds promising, esepecially about recreating the sheet. It
doesn't have any connecting formulas. In fact all it is is a message for
users when they disable the macro feature. The workbook is locked and the
only spreadsheet visible is the one with the message. However, when macros
are enabled, there is nothing to keep the curious user from making the
message spreadsheet visible and deleting it.

So I have a follow-up question. Is there a way to see if a particular
worksheet exist? On the Workbook Before Close event, I could test to sheet
if the worksheet exist and if not, recreate it.

Thanks for your suggestions.

"Dave Peterson" wrote:

If you don't want to use workbook protection, then I don't think you can stop it
or catch it.

But you could use some other event to (Workbook_SheetSelectionChange???) to look
for it. If it's gone, give that user a severe chastising.

Or ...maybe... keep a hidden copy of the worksheet and just recreate that just
deleted worksheet. (This may not help--if you have formulas in other sheets
that refer to that worksheet, it'll be too late.)



JR_06062005 wrote:

Is there a way to prevent a userfrom deleting a single spreadsheet? I don't
want to lock down the whole workbook, but I would like to protect one
worksheet in the workbook. I was looking for something like:

Sub Worksheet_BeforeDelete (lgDelete as Boolean)

But of course, no such option exist. Any help will be greatly appreciated.


--

Dave Peterson


--

Dave Peterson
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
Prevent deleting functions JKeef Excel Discussion (Misc queries) 6 September 10th 08 12:06 PM
Prevent user deleting an XLS file helmekki[_125_] Excel Programming 3 January 30th 06 04:29 AM
how prevent formula in cell from deleting when deleting value???? sh-boom New Users to Excel 1 September 30th 05 06:12 PM
How do I prevent someone from deleting a workbook? JSP Excel Discussion (Misc queries) 5 September 5th 05 04:51 PM
How to prevent deleting certain rows Dory en Ed Excel Programming 1 July 2nd 05 04:48 PM


All times are GMT +1. The time now is 01:40 AM.

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"