protectedsaving of file

wmtsub

Active Member
Joined
Jun 20, 2018
Messages
322
is there someway that i can ran a macro or a script or an object thast would not permit anyone to save my file unless they have a password other than protecting the file in wiondows? I wonder if that can be done from insiew the workbook.
 
soI created a UAL.TXT file in my document folder and added my name. Corrected the path to its location and saved a file. then opened the txt file and changed my name. opened and saved the xls again and it allowed me to. Does nto seem to stop teh un authorized person from saving the file.

I like the idea of a Whitelist abd in the future I may adopt that tactic. But right now what I really need is to not allow the file to be saved [just closed] if teh system user name is not "ME". How do i adjust the script for that?
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Got a solution, thought to share it:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Application.UserName = "***" Then GoTo xit
Cancel = True 'Cancels any request to save the file
Application.ThisWorkbook.Saved = True 'Tells Excel that the file has already been saved (this prevents Excel from requesting that you save the file when you close it)

xit:
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,652
Messages
6,126,035
Members
449,281
Latest member
redwine77

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