Hi Guys
I am pretty good with VBA for Access but Excel is another universe.
I have code in the thisworkbook that does not allow the user to hit the X close button. This works fine.
However
I have code that creates a new window the new window and current window are next to each other.
The user can still close one of the windows ..I would have thought that the thisworkbook function would apply to both windows. The users should not be allowed to close the windows I want them to use my cmd buttons...any ideas on how to fire the thisworkbook function so it applies to both windows
here is the code
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If CloseMode = vbFormControlMenu And Cancel_Code = Empty Then
Cancel = True
Exit Sub
End If
End Sub
then in my module i have
Public Cancel_Code As String
Sub Close_Workbook()
ActiveSheet.Select
Cancel_Code = "False"
Application.Quit
I am pretty good with VBA for Access but Excel is another universe.
I have code in the thisworkbook that does not allow the user to hit the X close button. This works fine.
However
I have code that creates a new window the new window and current window are next to each other.
The user can still close one of the windows ..I would have thought that the thisworkbook function would apply to both windows. The users should not be allowed to close the windows I want them to use my cmd buttons...any ideas on how to fire the thisworkbook function so it applies to both windows
here is the code
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If CloseMode = vbFormControlMenu And Cancel_Code = Empty Then
Cancel = True
Exit Sub
End If
End Sub
then in my module i have
Public Cancel_Code As String
Sub Close_Workbook()
ActiveSheet.Select
Cancel_Code = "False"
Application.Quit