Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
57121 error, but not a Mac in sight
Hi folks
I have a very simple workbook open event that elicits a 57121 error message whenever it runs. All the articles in knowledge base relating to this debug code involve Macs, but I can absolutely guarantee that this spreadsheet has never been near a Mac. If you run the code independently (i.e. not as a workbook open event), it's fine, and it also worked perfectly in previous editions of the workbook (Excel 2000). The code in question is: Private Sub Workbook_Open() If Sheets("Price").Range("J64") = 1 And Sheets("Price").Range("J66") = 1 Then Disable_SaveAs End If End Sub The code hangs on the IF statement line. Disable_SaveAs is a nice simple routine to stop people making numerous copies of the spreadsheet once certain criteria are met: Sub Disable_SaveAs() CommandBars("File").Controls.Item("Save As...").Enabled = False 'Disable Right click option on Toolbars CommandBars("ToolBar List").Enabled = False 'To disable the selection of the Save as icon 'available via Right click / Tools / customize. CommandBars("Tools").Controls.Item("Customize...") .Enabled = False Dim iOKOnly As Integer iOKOnly = MsgBox("SaveAs is disabled on this worksheet to prevent" & vbCrLf & "coded budgets being replicated." & vbCrLf & vbCrLf & "Please use a new budget form for your new project.", vbOKOnly Or vbCritical) If iOKOnly = vbOK Then Exit Sub End If End Sub Any help on this is welcome. Thanks! (PS: the SaveAs function is re-enabled on "workbook before close", in case you were wondering...) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Eye-sight and errors | Excel Discussion (Misc queries) | |||
Runtime error 57121 | Excel Discussion (Misc queries) | |||
Run-Time error 57121 | Excel Programming | |||
###Error 57121### | Excel Programming | |||
error 57121 | Excel Programming |