I
Iain Bishop
The following routine is executed when the Workbook_BeforeSave event fires:
Public Sub SaveWagesCheckboxValues()
Dim lngStaffNo As Long
On Error GoTo Handler
Workbooks("1Wages.xls").Worksheets("Weekly Worksheet").Unprotect
Password:="pjjs"
For lngStaffNo = 1 To 24
Workbooks("1Wages.xls").Worksheets("Weekly
Worksheet").Cells(lngStaffNo + 1, 110).Value =
Workbooks("1Wages.xls").Worksheets("Weekly
Worksheet").OLEObjects("chkHoliday" & lngStaffNo).Object.Value
Next
Workbooks("1Wages.xls").Worksheets("Weekly Worksheet").Protect
Password:="pjjs"
Exit Sub
Handler:
MsgBox "Error in Wages modWindowMaintenance.SaveWagesCheckboxValues: " &
Err.Number & " " & Err.Description, vbOKOnly, "ZR"
Exit Sub
End Sub
On the line "Workbooks("1Wages.xls").Worksheets("Weekly
Worksheet").Cells(lngStaffNo + 1, 110).Value = ..." I get the error 'The
cell or chart you are trying to change is protected and therefore
read-only.'
The password is correct, everything is qualified. Does anyone know why this
is failing. Is it something to do with the Workbook_BeforeSave event ?
Many Thanks,
Iain
Public Sub SaveWagesCheckboxValues()
Dim lngStaffNo As Long
On Error GoTo Handler
Workbooks("1Wages.xls").Worksheets("Weekly Worksheet").Unprotect
Password:="pjjs"
For lngStaffNo = 1 To 24
Workbooks("1Wages.xls").Worksheets("Weekly
Worksheet").Cells(lngStaffNo + 1, 110).Value =
Workbooks("1Wages.xls").Worksheets("Weekly
Worksheet").OLEObjects("chkHoliday" & lngStaffNo).Object.Value
Next
Workbooks("1Wages.xls").Worksheets("Weekly Worksheet").Protect
Password:="pjjs"
Exit Sub
Handler:
MsgBox "Error in Wages modWindowMaintenance.SaveWagesCheckboxValues: " &
Err.Number & " " & Err.Description, vbOKOnly, "ZR"
Exit Sub
End Sub
On the line "Workbooks("1Wages.xls").Worksheets("Weekly
Worksheet").Cells(lngStaffNo + 1, 110).Value = ..." I get the error 'The
cell or chart you are trying to change is protected and therefore
read-only.'
The password is correct, everything is qualified. Does anyone know why this
is failing. Is it something to do with the Workbook_BeforeSave event ?
Many Thanks,
Iain