WorkbookClose_ANmar

Closes a workbook, checks if it is already open first, works for workbooks within same instance

Function WorkbookClose_ANmar(WkNa, Optional SaveitifClosing = 0)
' needs FindFile
If FindFile(WkNa) Then
SaSa = False
If SaveitifClosing = 1 Then SaSa = True
Workbooks(WkNa).Close SaSa
End If
End Function

Parameters

WkNa, Optional SaveitifClosing

Examples

WorkbookClose_ANmar "Data.xlsx", 1

Views 55 Downloads 17

Perm link