Use password to remove controls set by Macro
Closed
Kyle
-
Oct 17, 2011 at 12:10 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Oct 20, 2011 at 08:59 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Oct 20, 2011 at 08:59 AM
Hello,
I created a Macro that forces users to click "Enable Macro" or the rest of the sheets in the excel document will not populate (unhide). Also when they click "Enable MAcro" it removes the ability to Cut/Copy/Paste throughout the entire document.
How do I password enable the document so that when an authorized user types in a password it will allow them to Cut/Copy/Paste? Would like to do this in the form of a button.
Thanks!
I created a Macro that forces users to click "Enable Macro" or the rest of the sheets in the excel document will not populate (unhide). Also when they click "Enable MAcro" it removes the ability to Cut/Copy/Paste throughout the entire document.
How do I password enable the document so that when an authorized user types in a password it will allow them to Cut/Copy/Paste? Would like to do this in the form of a button.
Thanks!
Related:
- Use password to remove controls set by Macro
- Ubuntu remove password - Guide
- Winrar set password not working - Guide
- How to remove deep freeze without password - Guide
- Quicktime hide controls - Guide
- How to remove call barring in keypad mobile ✓ - Android Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Oct 18, 2011 at 10:39 AM
Oct 18, 2011 at 10:39 AM
HI Kyle,
See if this yields the desired result:
Create a button and goto the properties of the button.
Change (Name) into: cmdProtection
Change Caption into: Click here to protect all sheets
Still being in design mode, right-click the button and select view code.
Use this code:
Now change everything/something/nothing between two double quotes ("") to suit your personal style.
Best regards,
Trowa
See if this yields the desired result:
Create a button and goto the properties of the button.
Change (Name) into: cmdProtection
Change Caption into: Click here to protect all sheets
Still being in design mode, right-click the button and select view code.
Use this code:
Private Sub cmdProtection_Click() Const PW As String = "Password" Dim ws As Worksheet Dim x As String x = InputBox("Please provide password") If cmdProtection.Caption = "Click here to protect all sheets" And x = PW Then For Each ws In Worksheets ws.Protect Password:=PW, DrawingObjects:=True, Contents:=True, Scenarios:=True Next ws cmdProtection.Caption = "Click here to unprotect all sheets" ElseIf cmdProtection.Caption = "Click here to unprotect all sheets" And x = PW Then For Each ws In Worksheets ws.Unprotect Password:=PW Next ws cmdProtection.Caption = "Click here to protect all sheets" End If End Sub
Now change everything/something/nothing between two double quotes ("") to suit your personal style.
Best regards,
Trowa
Oct 19, 2011 at 08:56 AM
In my code I have:
Private Sub Workbook_Deactivate()
Call ToggleCutCopyAndPaste(True)
End Sub
how could we ues this to create a button that is password enabled to Activate the 'ToggleCutCopyPaste'
Kyle
Oct 20, 2011 at 08:59 AM
Does this work for you?:
Have no idea if this would work for you since I do not know what code is behind "ToggleCutCopyAndPaste".
"Private Sub Workbook_Deactivate()" will make the code run when you exit the workbook and is no option when you want to use a button.
Best regards,
Trowa