Hi Guys,
The workbook I’ve created has individual pages locked to the user (same password for each sheet), also I have locked the VBA Project.
When I open the book I have made the sheets visible and unlocked them to save me time, however I also want the VBA Project to be unlocked.
I have tried to record a macro however to record I need to unlock the VBA then I end up with a blank macro.
I have limited knowledge to vba so I tried Application.Unprotect (“pword”), which as you can imagine didn’t work. Any suggestions would be a great help.
Below is the On Open I have been using:
Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
Sheet2.LblUser.Caption = Application.UserName
Sheet2.Activate
If Application.UserName = "user.1" Then
a = MsgBox("Do You Need To Change Things?", vbYesNo)
If a = 6 Then
Sheet1.Visible = xlSheetVisible
Sheet1.Unprotect ("pword")
Sheet4.Visible = xlSheetVisible
Sheet4.Unprotect ("pword")
Sheet2.Activate
ActiveSheet.Unprotect ("pword")
Application.Unprotect (“pword”)
End If
Else
Application.Calculation = xlCalculationAutomatic
Sheet2.LblUser.Caption = Application.UserName
Sheet2.Activate
Sheet2.ScrollArea = "A1:M37"
End If
End Sub
The workbook I’ve created has individual pages locked to the user (same password for each sheet), also I have locked the VBA Project.
When I open the book I have made the sheets visible and unlocked them to save me time, however I also want the VBA Project to be unlocked.
I have tried to record a macro however to record I need to unlock the VBA then I end up with a blank macro.
I have limited knowledge to vba so I tried Application.Unprotect (“pword”), which as you can imagine didn’t work. Any suggestions would be a great help.
Below is the On Open I have been using:
Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
Sheet2.LblUser.Caption = Application.UserName
Sheet2.Activate
If Application.UserName = "user.1" Then
a = MsgBox("Do You Need To Change Things?", vbYesNo)
If a = 6 Then
Sheet1.Visible = xlSheetVisible
Sheet1.Unprotect ("pword")
Sheet4.Visible = xlSheetVisible
Sheet4.Unprotect ("pword")
Sheet2.Activate
ActiveSheet.Unprotect ("pword")
Application.Unprotect (“pword”)
End If
Else
Application.Calculation = xlCalculationAutomatic
Sheet2.LblUser.Caption = Application.UserName
Sheet2.Activate
Sheet2.ScrollArea = "A1:M37"
End If
End Sub