Vba To Close All Open Workbooks

[Solved] Vba To Close All Open Workbooks | Vb - Code Explorer | yomemimo.com
Question : vba close workbook

Answered by : james-martin-4hwjsdpunslo

Sub ExcelX_14_12_2022()
'Macro X for Excel to Close Active Window Excel file >> Add to QAT with "X" symbol
'SOURCE: [email protected]
'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

Source : | Last Update : Wed, 21 Dec 22

Answers related to vba to close all open workbooks

Code Explorer Popular Question For Vb