Forse la risposta non è coerente, ma se fai così, ti chiede se vuoi chiudere il programma o no:
codice:
'Chiusura della Frm con Exit o X:
Private Sub Form_QueryUnload(Cancel As Integer, unloadMode As Integer)
Select Case unloadMode
Case vbFormControlMenu
'il form è chiuso dall'utente:
Call mnuFileExit_Click
End Select
'Non esce dall'applicazione:
If intRisCD = vbNo Then
Cancel = 1
End If
End Sub
'-------------------------------------
'Exit da menù file:
Private Sub mnuFileExit_Click()
intRisCD = MsgBox("Chiudere l'applicazione ?", vbYesNo + vbQuestion, "Applicazioni Aziendali")
If intRisCD = vbYes Then
Unload Form1
Set Form1 = Nothing
End If
If intRisCD = vbNo Then
Exit Sub
End If
End Sub