Hi everybody,
I have the following code for closing the current workbook without saving changes >>
I want it to be developed to close all active workbooks
Thank you,Private Sub Workbook_BeforeClose(Cancel As Boolean) ActiveWorkbook.Saved = True End Sub
Hello Love Candle,
Copy this code into a VBA module. You can call the macro anytime, and anywhere you need in your code.
Sincerely,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
Leith Ross
Thank you so much for this perfect code
But, can you develop it more to close excel program completely not only the active workbooks windows only,
Thank you soooooooo much for this perfect code
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks