ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unprotect workbook (https://www.excelbanter.com/excel-programming/313771-unprotect-workbook.html)

Jean-Paul De Winter

Unprotect workbook
 
Hi,
To unprotect a sheet with a click on a pushbutton I wrote:

Private Sub CommandButton5_Click()
Dim thing As Worksheet
For Each thing In Worksheets
thing.Unprotect
Next thing
End Sub

But what is the syntax to unprotect and protect a workbook?
Thanks



Frank Kabel

Unprotect workbook
 
activeworkbook.protect
activeworkbook.unprotect

--
Regards
Frank Kabel
Frankfurt, Germany

"Jean-Paul De Winter" schrieb im Newsbeitrag
...
Hi,
To unprotect a sheet with a click on a pushbutton I wrote:

Private Sub CommandButton5_Click()
Dim thing As Worksheet
For Each thing In Worksheets
thing.Unprotect
Next thing
End Sub

But what is the syntax to unprotect and protect a workbook?
Thanks




Kurt[_6_]

Unprotect workbook
 

BTW, an easy way to both code and discover coding for operations that can be
done with menu items or mouse controls is to just start recording a macro,
perform the task you want with the mouse, stop recording and cut what you
want out of what you recorded.

"Jean-Paul De Winter" wrote in message
...
Hi,
To unprotect a sheet with a click on a pushbutton I wrote:

Private Sub CommandButton5_Click()
Dim thing As Worksheet
For Each thing In Worksheets
thing.Unprotect
Next thing
End Sub

But what is the syntax to unprotect and protect a workbook?
Thanks





Jean-Paul De Winter

Unprotect workbook
 
Hi
I the code of a pushbutton I wrote:

Private Sub CommandButton5_Click()
ActiveWorkbook.Unprotect
Dim thing As Worksheet
For Each thing In Worksheets
thing.Unprotect
Next thing
End Sub

This seems to work but, when protected I still can choose a cell (but I can
not change anything... that's OK)
What to write so I can't even choose the cell??
Thanks
JP
"Frank Kabel" schreef in bericht
...
activeworkbook.protect
activeworkbook.unprotect

--
Regards
Frank Kabel
Frankfurt, Germany

"Jean-Paul De Winter" schrieb im Newsbeitrag
...
Hi,
To unprotect a sheet with a click on a pushbutton I wrote:

Private Sub CommandButton5_Click()
Dim thing As Worksheet
For Each thing In Worksheets
thing.Unprotect
Next thing
End Sub

But what is the syntax to unprotect and protect a workbook?
Thanks






Frank Kabel

Unprotect workbook
 
Hi
this is an option of the protect worksheets dialog. To get the syntax
for this you may record a macro while manually protecting a sheet

--
Regards
Frank Kabel
Frankfurt, Germany

"Jean-Paul De Winter" schrieb im Newsbeitrag
...
Hi
I the code of a pushbutton I wrote:

Private Sub CommandButton5_Click()
ActiveWorkbook.Unprotect
Dim thing As Worksheet
For Each thing In Worksheets
thing.Unprotect
Next thing
End Sub

This seems to work but, when protected I still can choose a cell (but

I can
not change anything... that's OK)
What to write so I can't even choose the cell??
Thanks
JP
"Frank Kabel" schreef in bericht
...
activeworkbook.protect
activeworkbook.unprotect

--
Regards
Frank Kabel
Frankfurt, Germany

"Jean-Paul De Winter" schrieb im

Newsbeitrag
...
Hi,
To unprotect a sheet with a click on a pushbutton I wrote:

Private Sub CommandButton5_Click()
Dim thing As Worksheet
For Each thing In Worksheets
thing.Unprotect
Next thing
End Sub

But what is the syntax to unprotect and protect a workbook?
Thanks








All times are GMT +1. The time now is 11:05 AM.

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