LucaGiorgio

New Member
Joined
Jun 14, 2017
Messages
4
Hi All,

First post here so apologies if I miss something out or do something wrong!

I have created an automated unlocker and locker for my MI reports to make it quicker for me to change the report from clients restricted view to my opened view which consist of the below. My only annoyance is that I am unable to write or find anything to do with unprotecting the VBA password like the 'ActiveSheet.Unprotect Password:="Password"' does. I am looking for something like VBAProject.Unprotect Password:="Password". Can anyone help?

-----------------------------------------------------------------------------------------
Code:
Sub Unlocker()


Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.Calculation = xlCalculationAutomatic


ActiveSheet.Unprotect Password:="Password"
ActiveWorkbook.Unprotect Password:="Password"
ActiveWindow.DisplayWorkbookTabs = True


Sheets("Arrays").Visible = True
Sheets("Utilisation").Visible = True
Sheets("Speeding").Visible = True
Sheets("Harsh Incidents").Visible = True
Sheets("Trips Data").Visible = True
Sheets("Trend Data").Visible = True


Application.ScreenUpdating = True
Application.DisplayStatusBar = True


End Sub

-----------------------------------------------------------------------------------------

Sub Locker()


Application.ScreenUpdating = False
Application.DisplayStatusBar = False


Sheets("Arrays").Visible = xlVeryHidden
Sheets("Utilisation").Visible = xlVeryHidden
Sheets("Speeding").Visible = xlVeryHidden
Sheets("Harsh Incidents").Visible = xlVeryHidden
Sheets("Trips Data").Visible = xlVeryHidden
Sheets("Trend Data").Visible = xlVeryHidden


ActiveSheet.Protect Password:="Password"
ActiveWorkbook.Protect Password:="Password", Structure:=True, Windows:=False
ActiveWindow.DisplayWorkbookTabs = False


Application.Calculation = xlCalculationManual
Application.ScreenUpdating = True
Application.DisplayStatusBar = True


End Sub
 
Last edited by a moderator:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,136,970
Messages
5,678,895
Members
419,788
Latest member
Mukund2903

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top