Okay, thanks for that. Now, I'm not sure I understand what the second thing does (the add-in thing) but it seems to me it's not what I'm looking for.
The first solution looks interesting, but I don't know how to implement it.
What does "Public WithEvents App as Application" mean? Where do I select that? Should I create those from the Visual Basic tab? I've put the details below to make it easier.
Put code into ThisWorkboook module of the PERSONAL.XLSB and save
Public WithEvents App As Application
Private Sub Workbook_Open()
Set App = Application
End Sub
Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
If Not Me.Windows(1).Visible Then
If Workbooks.Count = 2 Then
'If MsgBox("Quit Excel?", vbYesNo + vbQuestion) = vbYes Then
App.OnTime Now, ThisWorkbook.CodeName & ".QuitMe"
'End If
End If
End If
End Sub
Private Sub QuitMe()
App.Quit
End Sub
Bookmarks