P
Paul
I have several worksheets that I am editing in Excel. These contain many
macros and respond to several forms. The code I build works fine until the
data sheets that are ment to be hidden from the users are protected with the
following macro.
Sub MakeMeInsecure()
Dim msg, MyValue
Dim ws As Object
On Error GoTo SkipIt
msg = "What's the magic word?"
MyValue = InputBox(msg, "Unprotect Workbook Objects", "")
ActiveWorkbook.Unprotect password:=MyValue
For Each ws In Application.Worksheets
ws.Unprotect password:=MyValue
ws.Visible = True
Next
SkipIt:
End Sub
Similarly the sheets are locked up by the following macro
Sub MakeMeSecure()
Dim msg, MyValue
Dim ws As Object
On Error GoTo SkipIt
msg = "What's the magic word?"
MyValue = InputBox(msg, "Protect Workbook Objects", "")
For Each ws In Application.Worksheets
ws.Protect password:=MyValue
If UCase(ws.CodeName) = "WSMAIN" Then
ws.Visible = True
Else
ws.Visible = False
End If
Next
ActiveWorkbook.Protect password:=MyValue
SkipIt:
End Sub
I must have tripped some tab or some security thing somewhere because before
I began editing this set of worksheets these worked fine. The sheets when
secure disappeared and when they were insecure they appeared. In either case
the worksheet associated forms popped up as desired and worked as desired.
Now they return Error 1004 when secured.
I have tracked down this data process and found that the worksheets are
locked and do not allow the form to access their data for changes, they are
read only when they are protected.
Please advise me on how to make them able to be edited by the macros and
form controlled VBA code etc while restricting the view of the data from the
user at the same time. Clearly this is some trick of the security settings
and I would like to know what it is.
Thanks in Advance
Paul
macros and respond to several forms. The code I build works fine until the
data sheets that are ment to be hidden from the users are protected with the
following macro.
Sub MakeMeInsecure()
Dim msg, MyValue
Dim ws As Object
On Error GoTo SkipIt
msg = "What's the magic word?"
MyValue = InputBox(msg, "Unprotect Workbook Objects", "")
ActiveWorkbook.Unprotect password:=MyValue
For Each ws In Application.Worksheets
ws.Unprotect password:=MyValue
ws.Visible = True
Next
SkipIt:
End Sub
Similarly the sheets are locked up by the following macro
Sub MakeMeSecure()
Dim msg, MyValue
Dim ws As Object
On Error GoTo SkipIt
msg = "What's the magic word?"
MyValue = InputBox(msg, "Protect Workbook Objects", "")
For Each ws In Application.Worksheets
ws.Protect password:=MyValue
If UCase(ws.CodeName) = "WSMAIN" Then
ws.Visible = True
Else
ws.Visible = False
End If
Next
ActiveWorkbook.Protect password:=MyValue
SkipIt:
End Sub
I must have tripped some tab or some security thing somewhere because before
I began editing this set of worksheets these worked fine. The sheets when
secure disappeared and when they were insecure they appeared. In either case
the worksheet associated forms popped up as desired and worked as desired.
Now they return Error 1004 when secured.
I have tracked down this data process and found that the worksheets are
locked and do not allow the form to access their data for changes, they are
read only when they are protected.
Please advise me on how to make them able to be edited by the macros and
form controlled VBA code etc while restricting the view of the data from the
user at the same time. Clearly this is some trick of the security settings
and I would like to know what it is.
Thanks in Advance
Paul