B
Bill Case
Hi;
I have built a little spreadsheet project form a club I am a member of. I
have one sheet of the Workbook password protected in order to make some
hidden columns in accessable to anyone other than executive members. The
password protection works fine on my computer, but when I transfer the file
to other club members the are not asked for a pass word wen they open the
hidden columns. Below is the VBA code I use to lock and protect those
columns.
Sub ExecProtect()
'
' ExecProtect Macro
' Macro recorded 08/21/2006 by William Case
'
'
Worksheets("Member_List").Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterFaceOnly:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=False, _
AllowFormattingRows:=True, _
AllowInsertingColumns:=True, _
AllowInsertingRows:=True, _
AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=True, _
AllowDeletingRows:=True, _
AllowSorting:=True, _
AllowFiltering:=True, _
AllowUsingPivotTables:=True
End Sub
Sub LockDef()
Sub BarLock()
'
' BarLock Macro
' Macro recorded 08/21/2006 by William Case
'
' Test and lock bar, address and fees columns
'
'
Worksheets("Member_List").Range("DataArea").Locked = False
Range(BarsToLock).Locked = True
Range(AddressToLock).Locked = True
Range(FeesToLock).Locked = True
End Sub
BarsToLock = "Bar1D,Bar2J,Bar3O,Bar4T,Bar5Y,Bar6AD,Bar7AI,Bar8AR,Bar9AZ"
AddressToLock = "Addresses"
FeesToLock = "Fees"
End Sub
Sub OpenAddresses()
'
' ExecProtect Macro
' Macro recorded 08/24/2006 by William Case
'
On Error GoTo OpenAddresses_Error
ExecUnprotect
Range(AddressToLock).Locked = False
UnHideAddresses
ExecProtect
'
On Error GoTo 0
Exit Sub
OpenAddresses_Error:
If Err.Description = "Method 'Range' of object '_Global' failed" Then
LockDef
Resume Next
Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
OpenAddresses of Module LockandProtectMod"
End If
End Sub
There is several other procedures to cover a complex range of possibilites.
They all work for me as they should. But the password 'bill' is not asked
for when this project is installed on another Excel using machine and another
user unhides hidden columns.
What have I missed?
Regards Bill
I have built a little spreadsheet project form a club I am a member of. I
have one sheet of the Workbook password protected in order to make some
hidden columns in accessable to anyone other than executive members. The
password protection works fine on my computer, but when I transfer the file
to other club members the are not asked for a pass word wen they open the
hidden columns. Below is the VBA code I use to lock and protect those
columns.
Sub ExecProtect()
'
' ExecProtect Macro
' Macro recorded 08/21/2006 by William Case
'
'
Worksheets("Member_List").Protect _
Password:="bill", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterFaceOnly:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=False, _
AllowFormattingRows:=True, _
AllowInsertingColumns:=True, _
AllowInsertingRows:=True, _
AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=True, _
AllowDeletingRows:=True, _
AllowSorting:=True, _
AllowFiltering:=True, _
AllowUsingPivotTables:=True
End Sub
Sub LockDef()
Sub BarLock()
'
' BarLock Macro
' Macro recorded 08/21/2006 by William Case
'
' Test and lock bar, address and fees columns
'
'
Worksheets("Member_List").Range("DataArea").Locked = False
Range(BarsToLock).Locked = True
Range(AddressToLock).Locked = True
Range(FeesToLock).Locked = True
End Sub
BarsToLock = "Bar1D,Bar2J,Bar3O,Bar4T,Bar5Y,Bar6AD,Bar7AI,Bar8AR,Bar9AZ"
AddressToLock = "Addresses"
FeesToLock = "Fees"
End Sub
Sub OpenAddresses()
'
' ExecProtect Macro
' Macro recorded 08/24/2006 by William Case
'
On Error GoTo OpenAddresses_Error
ExecUnprotect
Range(AddressToLock).Locked = False
UnHideAddresses
ExecProtect
'
On Error GoTo 0
Exit Sub
OpenAddresses_Error:
If Err.Description = "Method 'Range' of object '_Global' failed" Then
LockDef
Resume Next
Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
OpenAddresses of Module LockandProtectMod"
End If
End Sub
There is several other procedures to cover a complex range of possibilites.
They all work for me as they should. But the password 'bill' is not asked
for when this project is installed on another Excel using machine and another
user unhides hidden columns.
What have I missed?
Regards Bill