Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Just Learning
 
Posts: n/a
Default workbook Protection Toggle Macro

Does anyone have a macro for toggling workbook protection?

E.g., run the macro and it unprotects the workbook if it's in a protected
state and vice versa.

Thanks for any help given!
  #2   Report Post  
Don Guillett
 
Posts: n/a
Default

try

Sub protectunprotecttoggle()
If ActiveWorkbook.ProtectStructure = True Then
ActiveWorkbook.Unprotect Password = "d"
Else
ActiveWorkbook.Protect structu=True, Windows:=False, Password:="d"
End If
End Sub

--
Don Guillett
SalesAid Software

"Just Learning" wrote in message
...
Does anyone have a macro for toggling workbook protection?

E.g., run the macro and it unprotects the workbook if it's in a protected
state and vice versa.

Thanks for any help given!



  #3   Report Post  
Just Learning
 
Posts: n/a
Default

Thanks! It works great!

"Don Guillett" wrote:

try

Sub protectunprotecttoggle()
If ActiveWorkbook.ProtectStructure = True Then
ActiveWorkbook.Unprotect Password = "d"
Else
ActiveWorkbook.Protect structu=True, Windows:=False, Password:="d"
End If
End Sub

--
Don Guillett
SalesAid Software

"Just Learning" wrote in message
...
Does anyone have a macro for toggling workbook protection?

E.g., run the macro and it unprotects the workbook if it's in a protected
state and vice versa.

Thanks for any help given!




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
Strange Personal Macro Workbook Behavior stretch Excel Discussion (Misc queries) 4 August 4th 05 07:39 PM
macro for protection ynissel Excel Discussion (Misc queries) 3 August 3rd 05 09:52 PM
Macro to link Sheets to main workbook raven_guy Excel Discussion (Misc queries) 0 June 24th 05 12:36 PM
Macro working in "This Workbook", but not while in "Personal.xls" markx Excel Worksheet Functions 2 March 7th 05 04:08 PM
Run macro in new workbook BobP Excel Discussion (Misc queries) 3 February 9th 05 12:19 AM


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

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

About Us

"It's about Microsoft Excel"