Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Function to detect if Sheet is protected

Hi
What is the best way to find out if a Sheet is protected?
Is this a good way?
Public Function IsSheetProtected(i_wsSheet As Worksheet)
As Boolean

On Error Resume Next
'A dummy password to test if sheet is
protected...assume that no one have this password.
i_wsSheet.Unprotect
("NoOneIsAllowedToHaveThisPassword")
If (Err.Number < 0) Then
IsSheetProtected = True
Else
IsSheetProtected = False
End If

End Function

Regards
/Niklas
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Function to detect if Sheet is protected

Hi Niklas

One way:

Function IsLocked(wks As Worksheet) As Boolean
IsLocked = wks.ProtectContents
End Function

--
HTH. Best wishes Harald
Followup to newsgroup only please

"Niklas" skrev i melding
...
Hi
What is the best way to find out if a Sheet is protected?



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
Grouping Function on protected sheet vivi Excel Discussion (Misc queries) 1 August 14th 09 09:59 AM
INK Annotations function in a protected sheet Tina79 Excel Worksheet Functions 0 August 29th 07 07:22 AM
Spellcheck function in Protected Sheet gwinder Excel Worksheet Functions 11 January 28th 07 06:31 PM
show all function with sheet protected [email protected] Excel Discussion (Misc queries) 9 July 25th 06 06:01 PM
How to enable the sort function for a protected sheet lkjing Excel Discussion (Misc queries) 1 June 30th 05 01:18 PM


All times are GMT +1. The time now is 09:48 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"