Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unprotect workbook Kim Excel Discussion (Misc queries) 3 October 2nd 08 07:49 PM
Unprotect workbook Jana Excel Discussion (Misc queries) 0 July 5th 07 04:04 PM
unprotect workbook Deb Excel Discussion (Misc queries) 2 February 9th 07 07:40 PM
Unprotect Workbook Kent Excel Discussion (Misc queries) 1 February 4th 05 01:07 AM
Unprotect a Workbook Milind Excel Programming 0 September 10th 03 10:59 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"