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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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