I know that similar questions were already here, but their solutions do not work for me
It makes me a big headache, And already searched a lot on Google
I need to close Excel by Macro
The file is closed, but the program remains open
This is the code I have, and I do not know why it does not close the software, and I have no other windows open
Private Sub Workbook_BeforeClose(Cancel As Boolean)
   With ActiveWindow
     .DisplayHeadings = True                            'UnHides Row/Column Headings
     .DisplayHorizontalScrollBar = True                 'UnHides Horizontal Scroll Bar
     .DisplayVerticalScrollBar = True                   'UnHides Vertical Scroll Bar
     .DisplayWorkbookTabs = True                        'UnHides Workbook Tabs
   End With
   ActiveSheet.DisplayPageBreaks = True
   With Application
     .DisplayFullScreen = False                          'Sets Excel to Disable Full Screen
     .DisplayFormulaBar = True                           'UnHides Excel formula bar and toolbars
     .DisplayStatusBar = True                            'UnHides Excel Status Bar
     .CommandBars("Worksheet Menu Bar").Enabled = True   'UnHides Excel Menus
     .CommandBars("Standard").Visible = True             'Unides Standard Toolbar
     .CommandBars("Formatting").Visible = True           'UnHides Formatting Toolbar
End With
Application.DisplayFullScreen = False
ThisWorkbook.Close savechanges:=True
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True
Application.Quit
End Sub
And that's what happens after the code is run, and the software does not close (Even without X and the like, only when I minimize the software)
Possible ideas for the problem?

 
    