LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default test sheet for protection

I put this code in the Workbook BeforeClose Event to make sure the Sheet is
protected before I close the App. Works perfectly when I try to close the app
using the Close Button at top right of the window. When I close the App using
the code Application.Quit in a close button I put into a form,
ActiveSheet.ProtectContents is always False. If I use
Sheets("name").ProtectContents, same thing always False.

Does that make sense, is there a work around?

"Mike" wrote:

You were nearly there, try this:-

Sub isitprotected()
If ActiveSheet.ProtectContents = True Then
MsgBox ("Protected")
Else
MsgBox ("Unprotected")
End If
End Sub

Mike

"David" wrote:

Been racking my brains again...
Tried:
On Error Resume Next
If Not ActiveSheet.Protection Is Nothing Then
MsgBox "sheet is protected"
Else: MsgBox "Sheet is not protected"
On Error GoTo 0
End If
...but alas, no joy, please help

 
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
Excel Data Protection Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
Macro protection - How to test Windows registration infos Alex St-Pierre Excel Programming 3 March 10th 07 02:37 AM
How to test to see if a given sheet from is in a workbook from ano dajns Excel Programming 8 March 27th 06 10:20 PM
Sheet protection error msg - Unrequested sheet activation deltree[_3_] Excel Programming 0 January 28th 04 06:20 PM


All times are GMT +1. The time now is 11:03 PM.

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"