Hi, found plenty material on how to auto protect with VBA all sheets in a workbook on closure of the latter, but no info on how to auto protect the workbook itself (structure and window). Any ideas?
Hi, found plenty material on how to auto protect with VBA all sheets in a workbook on closure of the latter, but no info on how to auto protect the workbook itself (structure and window). Any ideas?
https://docs.microsoft.com/en-us/off...rkbook.protect
https://analysistabs.com/vba-code/workbook/m/protect/
https://exceloffthegrid.com/vba-code...ect-workbooks/
Just three that I found when I Googled "VBA protect workbook".
Last edited by AliGW; 07-11-2019 at 05:15 PM.
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
Forum Rules (updated August 2023): please read them here.
Just three that I found when I Googled "VBA protect workbook".[/QUOTE]
This is very basic and I use it. My goal is to make the workbook protected om closing it, as I may forgot to do so before sending it to other people.
If it is to make sure that it protects, you will need the Workbook_BeforeClose Event.
If you have a Macro called "Protect" to protect your workbook, then this should do it!
Please Login or Register to view this content.
Thanks. Made the macro, placed your code in This workbook.. does wok. Dis you tried it?
Last edited by AliGW; 07-13-2019 at 11:21 AM. Reason: Please don't quote unnecessarily!
Does or does not work? Please clarify.
Something like this?
In the ThisWorkbook module
Please Login or Register to view this content.
At workbook closure I get the following message: Compile error! Procedure declaration does not match description of event or procedure having the same name.
Place an example of your file with the code as you applied it.
Attached sample
Please Login or Register to view this content.
Thanks but this protects the worksheets (which I already figured out), but not the workbook (the subject of my post)
Last edited by AliGW; 07-13-2019 at 12:40 PM. Reason: Please don't quote unnecessarily!
Administrative Note:
Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!
For normal conversational replies, try using the QUICK REPLY box below.
Just to mention that the issue is still unresolved (does not work)... if somebody is confused by my typo in a previous post
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks