Protected Worksheet with password

Tonysdilemma

New Member
Joined
Aug 2, 2020
Messages
30
Office Version
  1. 2016
Platform
  1. Windows
Hi
I have worksheet protected with password
I have "Select unlocked cells" checkbox ticked
I have "Edit Objects" checkbox ticked
I save my worksheet to a file.
When I go to use worksheet again,
the "Select unlocked cells" checkbox is still ticked
BUT I notice "Edit Objects" checkbox is UNTICKED
I need "Edit Objects" checkbox to remained TICKED

Any assistance is appreciated
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Do you have any vba code at all in the workbook or acting on the workbook? Could it perhaps be unprotecting the worksheet and re-protecting but without the allowing Edit Objects?
 
Upvote 0
Do you have any vba code at all in the workbook or acting on the workbook? Could it perhaps be unprotecting the worksheet and re-protecting but without the allowing Edit Objects?
Hi Peter_SSs
Yes I do have VBA.
Below is the VBA.
Hope you can help


Sub SaveSheetToPDF5()
Dim ws As Worksheet
Set ws = ActiveSheet
Sheet7.Unprotect Password:="Zebra007"
ws.Unprotect Password:="Zebra007"
ws.Range("A1:I12").ExportAsFixedFormat xlTypePDF, Filename:= _
"C:\Users\AClass\Desktop\Parcels Collected\" & ws.Range("A3").Value & ws.Range("B3").Value & ws.Range("C3").Value, Openafterpublish:=False
Sheet7.Range("B3:D3").ClearContents
Sheet7.Range("F3:G3").ClearContents
ws.Range("C6:E6").ClearContents
ws.Range("G7:H12").ClearContents
ws.Range("C9:E12").ClearContents
ws.Protect Password:="Zebra007", UserInterfaceOnly:=True
Sheet7.Range("A3").Value = Sheet7.Range("A3").Value Mod 99 + 1.01
Sheet7.Protect Password:="Zebra007", UserInterfaceOnly:=True
Sheet7.Activate
End Sub
 
Upvote 0
I'm not sure why you are using UserInterfaceOnly:=True
That is normally to save code having to unprotect the sheet and re-protect but since you are doing that anyway, I would suggest trying these changes within your code.


Rich (BB code):
ws.Protect Password:="Zebra007", UserInterfaceOnly:=True
ws.Protect Password:="Zebra007", DrawingObjects:=False, Contents:=True, Scenarios:=True

Sheet7.Protect Password:="Zebra007", UserInterfaceOnly:=True
Sheet7.Protect Password:="Zebra007", DrawingObjects:=False, Contents:=True, Scenarios:=True

Do you really have two different sheets you are applying protection to or is this protecting the same sheet twice?
 
Upvote 0
Hi Peter SSs
This helped. Thank you
Yes I have two different sheets I am applying protection to.
The idea is when I save 2nd sheet it takes me back to 1st sheet.
I am using UseInterfaceOnly:=True because if I don't, for some reason when I save 2nd sheet it takes me to VBA page instead of sheet 1
Again, Thank you
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

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
Back
Top