Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unprotect via prompt


Hi Rog,

Thanks for the reply but i should pprovide more info. The buttons ar
actually on a separate sheet. Does this affect the manual process o
protecting/unprotecting sheets??

Cheers!!!!!

--
gavme
-----------------------------------------------------------------------
gavmer's Profile: http://www.excelforum.com/member.php...nfo&userid=666
View this thread: http://www.excelforum.com/showthread.php?threadid=26268

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Unprotect via prompt

After some private exchanges:

Option Explicit

Private Sub CommandButton1_Click()
'unprotect

Application.ScreenUpdating = False

If Worksheets("sheet2").ProtectContents _
Or Worksheets("sheet2").ProtectDrawingObjects _
Or Worksheets("sheet2").ProtectScenarios Then
Worksheets("sheet2").Activate
On Error Resume Next
Application.Dialogs(xlDialogProtectDocument).Show
On Error GoTo 0
Else
MsgBox "already unprotected"
End If

If Worksheets("sheet2").ProtectContents _
Or Worksheets("sheet2").ProtectDrawingObjects _
Or Worksheets("sheet2").ProtectScenarios Then
MsgBox "Please provide the correct password when prompted " & _
"when you try this again."
End If

Me.Activate

Application.ScreenUpdating = True

End Sub

Private Sub CommandButton2_Click()
'protect

Application.ScreenUpdating = False

If Worksheets("sheet2").ProtectContents _
Or Worksheets("sheet2").ProtectDrawingObjects _
Or Worksheets("sheet2").ProtectScenarios Then
MsgBox "already protected"
Else
Worksheets("sheet2").Activate
Application.Dialogs(xlDialogProtectDocument).Show
End If

If Worksheets("sheet2").ProtectContents _
Or Worksheets("sheet2").ProtectDrawingObjects _
Or Worksheets("sheet2").ProtectScenarios Then
Else
MsgBox "The worksheet is not protected"
End If

Me.Activate

Application.ScreenUpdating = True

End Sub

gavmer wrote:

Hi Rog,

Thanks for the reply but i should pprovide more info. The buttons are
actually on a separate sheet. Does this affect the manual process of
protecting/unprotecting sheets??

Cheers!!!!!!

--
gavmer
------------------------------------------------------------------------
gavmer's Profile: http://www.excelforum.com/member.php...fo&userid=6662
View this thread: http://www.excelforum.com/showthread...hreadid=262682


--

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
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
Unprotect Conditional Formatting Excel Discussion (Misc queries) 3 September 5th 05 02:49 PM
Unprotect via prompt gavmer[_80_] Excel Programming 1 September 23rd 04 08:58 AM
Protecting Multiple sheets with prompt for password to unprotect pkley Excel Programming 1 January 10th 04 06:46 AM
Unprotect a Workbook Milind Excel Programming 0 September 10th 03 10:59 PM


All times are GMT +1. The time now is 07:08 PM.

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"