View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
freseh freseh is offline
external usenet poster
 
Posts: 1
Default Check if activesheet is protected

Hello Everyone!

I have a small problem that needs a simple solution.
How do I check with VBA if my activesheet is password protected?

What I want to have is a macro that protect if it's unprotected and
vice verse.

And this doesn't work, the red text must be something else :

If ActiveSheet.Protect.Enabled = False Then
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True, Password:="bossboss"
Else
ActiveSheet.Unprotect Password:="bossboss"
End If

Thanks in advance for your help!


---
Message posted from http://www.ExcelForum.com/