Thanks. i have treid to have a look at that, but doesn't seem to work.
The problem is that the example talks about working on Book1, i need to be able to VBA on Personal as this is always open on excel start
This is all on Personal.xlsb
Public WithEvents ExcelAppEvents As Application
Private Sub ExcelAppEvents_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As Boolean)
Result = MsgBox("Do you want to continue?", vbYesNo + vbQuestion)
If Result = vbYes Then
MsgBox "You clicked Yes"
Else: MsgBox "You clicked No"
This is in the Module1
Public ApplicationClass As New ApplicationEventClass
Set ApplicationClass.ExcelAppEvents = Application