K
Keith74
Hi All
I've got the following code in the "ThisWorkbook" code object.
Option Explicit
Public WithEvents App As Application
Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As
Boolean)
Cancel = False
If Left(Wb.Name, 4) <> "Book" Then
MsgBox "beep"
Cancel = True
Exit Sub
End If
End Sub
Public Sub SetApp()
Set App = Application
End Sub
and in another module
ThisWorkbook.SetApp
the problem i'm having is that the "App" object clears as soon as
focus returns to the calling module. Anyone have any idea why, i'm at
a complete loss on this one.
cheers
Keith
I've got the following code in the "ThisWorkbook" code object.
Option Explicit
Public WithEvents App As Application
Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As
Boolean)
Cancel = False
If Left(Wb.Name, 4) <> "Book" Then
MsgBox "beep"
Cancel = True
Exit Sub
End If
End Sub
Public Sub SetApp()
Set App = Application
End Sub
and in another module
ThisWorkbook.SetApp
the problem i'm having is that the "App" object clears as soon as
focus returns to the calling module. Anyone have any idea why, i'm at
a complete loss on this one.
cheers
Keith