I made an excel application, when I click quit button, it crashes.
I already tried many options for the code and all crashes:
If ThisWorkbook.Saved = True Then
'ThisWorkbook.Application.Quit
'Application.Quit
ActiveWorkbook.Close
ElseIf MsgBox(“Desea Guardar los cambios?”, vbYesNo) = vbYes Then
ThisWorkbook.Save
ThisWorkbook.Application.DisplayAlerts = False
'ThisWorkbook.Application.Quit
ActiveWorkbook.Close
'Application.Quit
Else
ThisWorkbook.Application.DisplayAlerts = False
'ThisWorkbook.Application.Quit
ActiveWorkbook.Close
'Application.Quit
End If
All the commented items are the tries that I have done.
For your information, this is a userform app with the background of excel hidden.
I appreciate your help.
Best regards