ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Ensure sheet is saved password Protected (https://www.excelbanter.com/excel-programming/272796-ensure-sheet-saved-password-protected.html)

MrAlMackay

Ensure sheet is saved password Protected
 
All

Need to be able to protect my spreadsheet once it is closed down.

Is it possible to ensure to do the following:

1) With every sheet in workbook
- Protect all sheets
- Set password of "Test"

2) Would need this to happen when the spreadsheet is closed down, so assume I
could just put this in Auto_Close module?

I know its not normally advised to put the password within the module itself,
however need to ensure that the sheet is not shut down without being protected
first.

Appreciate any help you can offer on the above.

Many Thanks, Al Mackay ( )

Abdul Salam

Ensure sheet is saved password Protected
 
Try this:


Sub ProtectSheets()
strPWord = "Test"
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect strPWord
Next
End Sub

Abdul Salam


-----Original Message-----
All

Need to be able to protect my spreadsheet once it is

closed down.

Is it possible to ensure to do the following:

1) With every sheet in workbook
- Protect all sheets
- Set password of "Test"

2) Would need this to happen when the spreadsheet is

closed down, so assume I
could just put this in Auto_Close module?

I know its not normally advised to put the password

within the module itself,
however need to ensure that the sheet is not shut down

without being protected
first.

Appreciate any help you can offer on the above.

Many Thanks, Al Mackay ( )
.



All times are GMT +1. The time now is 06:59 AM.

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