M
MDW
I'm trying to write code that will disable the "Sort" menu option when I open
a specific workbook, and enable it again when the workbook is closed. The
actual code that does that is written, but when I place references to it in
the Workbook_Open sub, it is not called.
Just to test, here is the code I put in:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call disable_sort(True)
MsgBox "Workbook_BeforeClose"
End Sub
Private Sub Workbook_Open()
MsgBox "Workbook_Open"
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'Call disable_sort(False)
MsgBox "Workbook_SheetActivate"
End Sub
When I open the file, nothing at all happens. When I move to a different
sheet, the message box for SheetActivate pops up. When I close the file, the
"Workbook_Close" message box appears.
So what's the deal with Workbook_Open? </Seinfeld>
a specific workbook, and enable it again when the workbook is closed. The
actual code that does that is written, but when I place references to it in
the Workbook_Open sub, it is not called.
Just to test, here is the code I put in:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call disable_sort(True)
MsgBox "Workbook_BeforeClose"
End Sub
Private Sub Workbook_Open()
MsgBox "Workbook_Open"
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'Call disable_sort(False)
MsgBox "Workbook_SheetActivate"
End Sub
When I open the file, nothing at all happens. When I move to a different
sheet, the message box for SheetActivate pops up. When I close the file, the
"Workbook_Close" message box appears.
So what's the deal with Workbook_Open? </Seinfeld>