I have a worksheet that has some locked and unlocked cell, and the worksheet is protected with a password that only I know.
When the user closes/saves the document, I want to prompt if they want to save the file as an "Internal Use Only" file that preserves the status of the locked/unlocked cells. Of course, a normal save will do that.
But I also want to prompt at close/save if they want to save the file as an "External Use Only" file that will be sent outside the company to customers. In that case, I want to set ALL the cells to locked status before the save, so that customers won't be able to change any of the cell values (e.g., quoted prices).
When the file is opened, I want to prompt for a password that only the internal users will know. If the password is entered, code needs to restore the previous locked/unlocked status of the cells so that internal users can again work with the file.
I'm thinking I'd have to loop through all the cells from A1 to LastCell, and perhaps store cell addresses and settings onto a hidden worksheet. Then use those values to reset the locked/unlocked status of the cells if the password is entered upon open. But I'm not sure how to do that, or if there's a better way.
Why not save two versions of file, one with some cells locked/unlocked and others all locked? Well, I suppose that's an option, but if the "internal use" file gets accidentally deleted, then there's no way to recover and have a file where some cells are locked and others unlocked for internal use.
Any ideas/code ideas, folks? Thanks!
When the user closes/saves the document, I want to prompt if they want to save the file as an "Internal Use Only" file that preserves the status of the locked/unlocked cells. Of course, a normal save will do that.
But I also want to prompt at close/save if they want to save the file as an "External Use Only" file that will be sent outside the company to customers. In that case, I want to set ALL the cells to locked status before the save, so that customers won't be able to change any of the cell values (e.g., quoted prices).
When the file is opened, I want to prompt for a password that only the internal users will know. If the password is entered, code needs to restore the previous locked/unlocked status of the cells so that internal users can again work with the file.
I'm thinking I'd have to loop through all the cells from A1 to LastCell, and perhaps store cell addresses and settings onto a hidden worksheet. Then use those values to reset the locked/unlocked status of the cells if the password is entered upon open. But I'm not sure how to do that, or if there's a better way.
Why not save two versions of file, one with some cells locked/unlocked and others all locked? Well, I suppose that's an option, but if the "internal use" file gets accidentally deleted, then there's no way to recover and have a file where some cells are locked and others unlocked for internal use.
Any ideas/code ideas, folks? Thanks!