Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
how can i close all open office files as i close current active workbook?
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
HI,
Keep shift key pressed, menu File/Close all or Private Sub Workbook_BeforeClose(Cancel As Boolean) dim wb as workbook for each wb in workbooks if wb.name < thisworkbook.namen then wb.close False 'close without save next End Sub Put this in the Thisworkbook module Regards JY "colt" wrote in message ... how can i close all open office files as i close current active workbook? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this macro
Sub CloseAllWorkbook() Dim i As Integer For i = Workbooks.Count To 1 Step -1 If ThisWorkbook.Name < Workbooks(i).Name Then Workbooks(i).Close End If Next i End Sub "Jean-Yves" wrote: HI, Keep shift key pressed, menu File/Close all or Private Sub Workbook_BeforeClose(Cancel As Boolean) dim wb as workbook for each wb in workbooks if wb.name < thisworkbook.namen then wb.close False 'close without save next End Sub Put this in the Thisworkbook module Regards JY "colt" wrote in message ... how can i close all open office files as i close current active workbook? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks Muhammed
this code works well many thanks for your response I have now overcome a hurdle in my application which has taken some time. regards colt "Muhammed Rafeek M" wrote: try this macro Sub CloseAllWorkbook() Dim i As Integer For i = Workbooks.Count To 1 Step -1 If ThisWorkbook.Name < Workbooks(i).Name Then Workbooks(i).Close End If Next i End Sub "Jean-Yves" wrote: HI, Keep shift key pressed, menu File/Close all or Private Sub Workbook_BeforeClose(Cancel As Boolean) dim wb as workbook for each wb in workbooks if wb.name < thisworkbook.namen then wb.close False 'close without save next End Sub Put this in the Thisworkbook module Regards JY "colt" wrote in message ... how can i close all open office files as i close current active workbook? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jean-Yves
thanks so much - i have been working on this problem for some time. I needed the code version and I just got it to work - so excited. kindest regards colt. "Jean-Yves" wrote: HI, Keep shift key pressed, menu File/Close all or Private Sub Workbook_BeforeClose(Cancel As Boolean) dim wb as workbook for each wb in workbooks if wb.name < thisworkbook.namen then wb.close False 'close without save next End Sub Put this in the Thisworkbook module Regards JY "colt" wrote in message ... how can i close all open office files as i close current active workbook? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Closing Files | Excel Discussion (Misc queries) | |||
Closing Files | Excel Discussion (Misc queries) | |||
Closing files and saving files | Excel Worksheet Functions | |||
Closing Files and Reopening them in VBA | Excel Programming | |||
Closing files without save | Excel Programming |