ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting a workbooks protection/read only/locked (https://www.excelbanter.com/excel-programming/340856-setting-workbooks-protection-read-only-locked.html)

Jason Kontkanen

Setting a workbooks protection/read only/locked
 
Hello,

I've read various pages about locking ranges, protection, etc, but none of
it seems to work across the board. From VB, I'm opening a workbook, and the
entire thing should be locked. The user should be able to scroll and see
everything, but they shouldn't be able to edit anything. I specify read
only when I open it, and i call .Protect for the workbook, and as a test I
do .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True,
UserInterfaceOnly:=True to protect the only sheet in the workbook. What
ends up happening is part of the worksheet is protected, but not the entire
worksheet. What am I doing wrong, and what needs to be done to do it right?

Thanks,
Jason



Jim Cone

Setting a workbooks protection/read only/locked
 
Jason,

Have you tried locking all the cells, before protecting the sheet?...
Worksheets(1).Cells.Locked = True

Regards,
Jim Cone
San Francisco, USA


"Jason Kontkanen"
wrote in message
...
Hello,
I've read various pages about locking ranges, protection, etc, but none of
it seems to work across the board. From VB, I'm opening a workbook, and the
entire thing should be locked. The user should be able to scroll and see
everything, but they shouldn't be able to edit anything. I specify read
only when I open it, and i call .Protect for the workbook, and as a test I
do .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True,
UserInterfaceOnly:=True to protect the only sheet in the workbook. What
ends up happening is part of the worksheet is protected, but not the entire
worksheet. What am I doing wrong, and what needs to be done to do it right?
Thanks,
Jason




All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com