Sub ExcelX_14_12_2022()
'Macro X for Excel to Close Active Window Excel file >> Add to QAT with "X" symbol
'SOURCE: jam61mar@gmail.com
'https://paypal.me/1ClickQAT?country.x=GB&locale.x=en_GB
ScreenUpdating = False
Dim ActiveWorkbook As Object
Dim ProtectedViewWindow As Object
'If a file is Protected View, Make it Editable
If Application.ProtectedViewWindows.Count > 0 Then
'if protected view file is not active window
On Error Resume Next
Application.ActiveProtectedViewWindow.Edit
End If
'If Macro X is pressed in error with no file in Open Excel App
On Error Resume Next
'If active window has a document close it
Application.ActiveWorkbook.Close
ScreenUpdating = True
Exit Sub
End Sub