View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
blb blb is offline
external usenet poster
 
Posts: 1
Default error 424 - Object Required

I receive this error message sometimes while running the code below.
Out perhaps 1200 hits on this code it may error 2 or three times. Can
anyone see where the potential for error 424 would be?

Thanks!

Sub FreezePanes()
On Error GoTo ErrorHandler
If ActiveWindow.FreezePanes = False Then
MsgBox prompt:="The area to the left and top of the current
cell will be 'frozen'." & Chr(10) & _
"Select this menu option again to 'unfreeze'.",
Title:="CAP - Freeze Panes"
FreezeMenu.caption = "Un&freeze Panes"
Else
FreezeMenu.caption = "&Freeze Panes"
End If
ActiveWorkbook.Unprotect
ActiveWindow.FreezePanes = Not (ActiveWindow.FreezePanes)
ActiveWorkbook.Protect Windows:=True
Exit Sub
ErrorHandler:
Catch ThisWorkbook.Name, "FreezePanes"
End Sub