Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protecting/Unprotecting Workbook
I'd like to be able to protect a workbook from changes via VBA. In Word,
I have these two bits of code... Sub LockItUp(doit) If doit < wdNoProtection Then If ActiveDocument.ProtectionType = wdNoProtection Then ActiveDocument.Protect Type:=doit, NoReset:=True, Password:="myPass1234" End If End If End Sub Function UnlockIt() Dim wasLocked wasLocked = ActiveDocument.ProtectionType If ActiveDocument.ProtectionType < wdNoProtection Then ActiveDocument.Unprotect "myPass1234" End If UnlockIt = wasLocked End Function The function UnLockIt() simply locks up a document with a password and returns what the prior protection scheme was. LockItUp() simply locks it back up with whatever parameter it is given. I usually run these during save, close, open, etc... I generally know now how to do it in Excel, but how do I do it most effectively? :) Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Protecting and Unprotecting several worksheets at one time | Excel Discussion (Misc queries) | |||
protecting and unprotecting | Excel Worksheet Functions | |||
PROTECTING/UNPROTECTING SHEETS | Excel Discussion (Misc queries) | |||
Protecting and Unprotecting multiple sheets | Excel Programming | |||
Protecting & unprotecting worksheets | Excel Programming |