Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hi All I'm hoping someone can help with placing a Yes / No popup in an existing macro. I use this macro to protect / unprotect my worksheets. Sub Protect_Unprotect() Const PWORD As String = "password" Dim wkSht As Worksheet Dim statStr As String Application.ScreenUpdating = False For Each wkSht In ActiveWorkbook.Worksheets With wkSht statStr = statStr & vbNewLine & "Sheet " & .Name If .ProtectContents Then wkSht.Unprotect Password:=PWORD statStr = statStr & ": Unprotected" Else wkSht.Protect Password:=PWORD, _ DrawingObjects:=False, _ Contents:=True, _ Scenarios:=True, _ AllowFormattingColumns:=True, _ AllowFormattingRows:=True, _ AllowFiltering:=True ', _ AllowFormattingCells:=True, _ AllowDeletingRows:=True, _ AllowInsertingColumns:=True, _ AllowInsertingHyperlinks:=True, _ AllowInsertingRows:=True, _ Userinterfaceonly:=True, _ AllowDeletingColumns:=True, _ AllowUsingPivotTables:=True statStr = statStr & ": Protected" End If End With Next wkSht Application.ScreenUpdating = True MsgBox Mid(statStr, 2) End Sub My problem is that for some workbooks i need all of the qualifying permissions listed here to be reinstated on protection. In others , I don't need them. In these the limited basic permission to select locked / unlocked in needed. What I'm trying to put in place is a Yes / No popup asking 'All qualifying permissions?'. If the answer is 'Yes' then it proceeds through the macro. If the answer is 'No' then it jumps over the permissions listed in the macro and protects with the basic select locked / unlocked cells. Can someone help with this? I did try some coding of my own , but am struggling to find the right place in the code to place the popup VBA. Grateful for any help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Qualifying permissions in protect unprotect macro. | Excel Discussion (Misc queries) | |||
Protect and Unprotect all worksheets with macro | Excel Discussion (Misc queries) | |||
Macro to Protect OK, Unprotect now messed up! | Excel Worksheet Functions | |||
400 Error in Unprotect/Protect Macro | Excel Discussion (Misc queries) | |||
protect / unprotect VBA project by macro | Excel Discussion (Misc queries) |