XLA routines: EE_CloseOtherWorkbooks
Routine to close other workbooks
- this saves setting variables and tracking open workbooks
Sub EE_CloseOtherWorkbooks(wbKeepOpen As Workbook) 'http://excelexperts.com/xla-routines-eeCloseOtherWorkbooks for updates on this sub routine ' closes workbooks other than the workbook containing the code and another one specified Dim wbk As Workbook On Error Resume Next For Each wbk In Application.Workbooks If wbk.Name <> ThisWorkbook.Name Then If Not wbKeepOpen Is Nothing Then If wbk.Name <> wbKeepOpen.Name Then wbk.Close (False) End If End If End If Next End Sub
»
- Nick's blog
- Login or register to post comments
- 2926 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago