Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi everybody, I have the following code for closing the current workbook withou saving changes I want it to be developed to close all active workbooks Code ------------------- Private Sub Workbook_BeforeClose(Cancel As Boolean) ActiveWorkbook.Saved = True End Su ------------------- Thank you -- LoveCandl ----------------------------------------------------------------------- LoveCandle's Profile: http://www.excelforum.com/member.php...fo&userid=2861 View this thread: http://www.excelforum.com/showthread.php?threadid=55545 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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, -- LoveCandle ------------------------------------------------------------------------ LoveCandle's Profile: http://www.excelforum.com/member.php...o&userid=28612 View this thread: http://www.excelforum.com/showthread...hreadid=555457 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thank you soooooooo much for this perfect code -- LoveCandle ------------------------------------------------------------------------ LoveCandle's Profile: http://www.excelforum.com/member.php...o&userid=28612 View this thread: http://www.excelforum.com/showthread...hreadid=555457 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
close without saving | Excel Discussion (Misc queries) | |||
close w/o saving | Excel Worksheet Functions | |||
VBA - Close without saving changes | Excel Discussion (Misc queries) | |||
Close without saving | Excel Programming | |||
Close without Saving In VBA | Excel Programming |