• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Disable users to save the file

Dokat

Member
Hi,

I have below macro code which disables users to save the file. If i put this code under "thisworkbook "and close the file it doesnt let me save the macro thus when i reopen the file macro is deleted. How can i save this macro so that other users cant save the file?

Code:
PrivateSub Workbook_BeforeSave(ByVal SaveAsUI AsBoolean, Cancel AsBoolean)

MsgBox "You can't save this workbook!"
Cancel =True

EndSub

Thank you
 
Hello Dokat
First, Open Excel not your file and disable macros
-----------------------------------------------------
001.png

Second, Open your file and put the code in ThisWorkbook module
----------------------------------------------------------------------
002.png

Third, Open Excel and enable macros
----------------------------------------
003.png

Finally, Open your workbook and make any changes and try to save
Regards
 
Last edited:
Hi Yasser,

I am on network an all macro security selections are greyed out. Is there a work around it?

Thanks
 
Back
Top