
User Interface Protection Problem
_There is a LOT of code associated with the User Forms so
I have included the relevant lines for the Workbook Open,
User Form that works (btnNextfrn_Click), User Form that
fails (btnNexCrs_Click, and Workbook Close.
_____________
Private Sub Workbook_Open()
ShowView "Open"
On Error Resume Next
ActiveWorkbook.Worksheets("Prep Front Nine").Protect _
Password:="lINDy", _
DrawingObjects:=False, _
Contents:=True, _
Scenarios:=False, _
UserInterfaceOnly:=True
ActiveWorkbook.Worksheets("Prep Back Nine").Protect _
Password:="lINDy", _
DrawingObjects:=False, _
Contents:=True, _
Scenarios:=False, _
UserInterfaceOnly:=True
ActiveWorkbook.Worksheets("Final Front Nine").Protect _
Password:="lINDy", _
DrawingObjects:=False, _
Contents:=True, _
Scenarios:=False, _
UserInterfaceOnly:=True
ActiveWorkbook.Worksheets("Prep Front Nine").Visible =
xlVeryHidden
ActiveWorkbook.Worksheets("Prep Back Nine").Visible =
xlVeryHidden
ActiveWorkbook.Worksheets("Final Front Nine").Visible
= xlVeryHidden
ActiveWorkbook.Worksheets("Final Back Nine").Visible =
xlVeryHidden
ActiveWorkbook.Worksheets("Temp").Visible =
xlVeryHidden
ActiveWorkbook.Worksheets("Rating").Visible =
xlVeryHidden
End Sub
_______________
' This snippet of code works!
Private Sub btnNextfrn_Click()
Set wsPrFr = ActiveWorkbook.Worksheets("Prep Front
Nine")
Unload Me
wsPrFr.Range("M1").Value = txtCourse.Value
End Sub
__________________________
This snippet of code gets the error message when it
reaches the last line of the snippet!
Private Sub btnNexCrs_Click()
Set wsFiFr = ActiveWorkbook.Worksheets("Final Front
Nine")
Set wsTemp = ActiveWorkbook.Worksheets("Temp")
Unload Me
wsTemp.Range("AL1").Value = txtDate.Value
' fails on above line
End Sub
________________
Quote:
>-----Original Message-----
>Hi George:
>If you post your code, it'll save people from trying to
guess at exactly
>where the problem might lie.
>--
>Regards,
>Vasant.
>> I have a workbook with 3 worksheets in Excel 2000 under
>> Windows 98.
>> As part of the Workbook Open, I protect each worksheet
>> individually for contents = true and User Interface
Only =
>> true. I also set each worksheet to Visible =
xlVeryHidden.
>> The user enters data through User Forms only. The user
>> forms enter data onto the first two worksheets
perfectly.
>> When the User Forms try to enter data onto the third
>> worksheet, a Run-Time Error '1004': The cell or chart
you
>> are trying to change is protected .... dialog is
presented.
>> The Microsoft Knowledge Base indicated that sometimes
too
>> many Protects can cause problems, so I have checked the
>> entire project for "Protect" and the only place that it
>> occurs is in Workbook Open and the Workbook Close. I
have
>> opened the Immediate window and checked the Protection
>> Mode of the Worksheet in question just before the code
>> tries to write to it and it comes back as "True"
>> indicating (I think) that the User Interface Only is set
>> to True.
>> Obviously, I can find no difference between the code for
>> the worksheets that work and the ones that don't work.
>> I am at a loss, any suggestions on where to look?
>.