Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
save prompt for user exit, but no save prompt for batch import? | Excel Discussion (Misc queries) | |||
Unprotect | Excel Discussion (Misc queries) | |||
Unprotect via prompt | Excel Programming | |||
Protecting Multiple sheets with prompt for password to unprotect | Excel Programming | |||
Unprotect a Workbook | Excel Programming |