ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protecting an entire workbook (https://www.excelbanter.com/excel-programming/299346-protecting-entire-workbook.html)

Dumbass

Protecting an entire workbook
 
Hi

I wrote a macro that saves a worksheet by state into a file for each branch; however, I would like to protect the entire workbook being saved before saving. I tried

For brancher = 1 To
bookername(brancher).Activat
ActiveWorkbook.Protect password:="millertime
ActiveWorkbook.Sav
ActiveWorkbook.Clos
Next branche

When the code executes, I do not get an error, but when I open that file open, there is no protection.

Thanks for the help


Vasant Nanavati

Protecting an entire workbook
 
Protecting a workbook is *not* the same as protecting all the worksheets.
Look at Help to understand the differences.

--

Vasant

"dumbass" wrote in message
...
Hi-

I wrote a macro that saves a worksheet by state into a file for each

branch; however, I would like to protect the entire workbook being saved
before saving. I tried:

For brancher = 1 To 8
bookername(brancher).Activate
ActiveWorkbook.Protect password:="millertime"
ActiveWorkbook.Save
ActiveWorkbook.Close
Next brancher

When the code executes, I do not get an error, but when I open that file

open, there is no protection.

Thanks for the help!





All times are GMT +1. The time now is 07:19 AM.

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