VBA/Excel/Access/Word/Excel/Range Permission — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:47, 26 мая 2010
Add Edit Range
Sub AddEditRange()
Dim ws As Worksheet, ual As UserAccessList, aer As AllowEditRange, usr As UserAccess
Set ws = ThisWorkbook.Sheets("Protection")
ws.Unprotect "Excel2003"
Set aer = ws.Protection.AllowEditRanges.Add("Edit Range", Range("UserEditRange"), "pass1")
Set usr = aer.Users.Add("Power Users", True)
ws.Protect "Excel2003"
End Sub
Remove Edit Ranges
Sub RemoveEditRanges()
Dim ws As Worksheet, ual As UserAccessList, aer As AllowEditRange
Set ws = ThisWorkbook.Sheets("Protection")
ws.Unprotect "Excel2003"
For Each aer In ws.Protection.AllowEditRanges
aer.Delete
Next
ws.Protect "Excel2003"
End Sub