Disable save, or set file as only read only mode for users

jaik22

Board Regular
Joined
Sep 23, 2016
Messages
102
Code:
Sub clsoing()




''ThisWorkbook.ChangeFileAccess Mode:=xlReadOnly
'ActiveWorkbook.ReadOnlyRecommended = True


    ActiveSheet.Protection.AllowEditRanges.Add Title:="Range1", Range:=Columns( _
        "A:AI")
        
With ActiveSheet
    .Protect Password:="test", DrawingObjects:=True, Contents:=True, Scenarios:=True _
        , AllowSorting:=True, AllowFiltering:=True
    .EnableSelection = xlUnlockedCells
    .EnableSelection = xlNoRestrictions
    
End With


End Sub

Hello,
I have that code to make workbook to be protected. However I had to add "AllowEditRange" code to let users do perform sort by in the workbook.
However, I do not want to make users save files after changing data. I've tried 2 read only codes above "AllowEditRange" code, but users are able to edit file, if they open up file not as read only.

Is there any good solution to users not save work over original file?
**This is not macro enable workbook.

Thank you!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Yes. Create a template workbook. (i.e. .xltx), This way the user cannot save over the original..
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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