Macro update
In Excel 97 and later, when you close the workbook containing the macro, the
macro stops.
how about
Dim wkbk as Workbook
for each wkbk in Workbooks
if wkbk.Windows(1).Visible then
wkbk.Save
end if
Next
application.Quit
--
Regards,
Tom Ogilvy
"Roger" wrote in message
...
I would like the following macro to shut down all open files including 1
hidden file and the shut down the Excel program. I have used this macro
for
many years in Excel 5. I am now upgrading to Excel 2002 where it doesn't
work. Do you have any suggestions as to what the problem could be?
Dim Index As Integer, Number As Integer, FinalNumber As Integer
'Index
is a loop counter
Number = Application.Workbooks.Count 'The Number of open Workbooks
FinalNumber = Number - 1 'The 1 refers to the
hidden file
For Index = 1 To FinalNumber 'Place the Workbook
names
in an array
ActiveWorkbook.Close saveChanges:=True
Next Index
Application.Quit
Thanks,
Roger
|