View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_605_] Leith Ross[_605_] is offline
external usenet poster
 
Posts: 1
Default Close without saving


Hello Love Candle,

Copy this code into a VBA module. You can call the macro anytime, and
anywhere you need in your code.


Code:
--------------------

Public Sub CloseAllWorkbooks()

Dim Wkb As Workbook

For Each Wkb In Workbooks
If Wkb.Name < ThisWorkbook.Name Then
Wkb.Saved = True
Wkb.Close
End If
Next Wkb

With ThisWorkbook
.Saved = True
.Close
End With

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=555457