Guys,
Any Ideas on How to build a macro and auto run on file start up that will prevent any user to Save or SaveAs.
BR,
Guys,
Any Ideas on How to build a macro and auto run on file start up that will prevent any user to Save or SaveAs.
BR,
Copy the code below to your "ThisWorkbook" in VBE
Obviously only works when Macros are enabled though![]()
Please Login or Register to view this content.
![]()
some person opening the workbook, he will not run any macro. Will this run automatically and upon which event
The first part will be when the user tries to save, the second will tell Excel the Workbook has been saved so you don't get the "Save changes" prompt when closing the book.
it doesnt do anything I am able to make changes and save and close
Well, that is odd... I've used that code for ages :-/
What version of Excel are you using?
can you tell me how to execute the code.
I just opened a new module in the subject workbook, pasted your code and saved and closed the file then. I again opened the file and changed somethings and I was able to save it.
excel 2010
As I said in my original post, you need to put that code into "ThisWorkbook", you don't create a Module for it.
From a fresh Workbook open up the VBE - In the Project Explorer you'll see Sheet1 (Sheet1) and directly under that "ThisWorkbook" - That is where the code should go.
OKAY, I got it now. Sorry.
Thanks, it works.
No problem - Glad we got there in the end![]()
This code works only one time.
When I close the workbook and open again, the Code is missing in ThisWorkbook - View Code
And it is enables for edit and save changes.
Please advise.
You need to have Saved the code into the Workbook for it to stay...
Either Disable Macros in Security, add the code, save and re enable them, or from the VBE - After Pasting in the code to the ThisWorkbook module go to the Immediate Window and type;
And then save the Workbook. Close it down, reopen it and saving should be disabled from that point.![]()
Please Login or Register to view this content.
But you won't be able to save it after you've added things to it without over riding it.
I've attached an example of it saved within a Workbook for you.
Do have any codes to prevent:
- Cut
- Copy
- Paste
- Drag and Drop
- Move/Copy Sheet
Do you need me to open a new thread for this question ?
Yes, start a new thread as they are different questions.
I did so, but there seems no solution on that thread,
Please have a look.
https://www.excelforum.com/excel-gen...ove-sheet.html
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks