Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing workbooks
Hi
Struggling with the following problem. Is it possible to close two workbooks working with VBA? I have tried following codes: Application.DisplayAlerts = False 'step 1 Windows("Book1.xls").Close 'step 2 Windows("Book2.xls").Close 'step 3 Application.DisplayAlerts = True 'step 4 Problem is, macro stops running after step 2! Thanks, Mischa |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing workbooks
If you close the workbook that contains the macro, the macro stops. Close
the other workbook first Workbooks("Book2.xls").Close SaveChanges:=Fasle ThisWorkbook.Close SaveChanges:=False -- Regards, Tom Ogilvy "Mischa Browne" wrote in message ... Hi Struggling with the following problem. Is it possible to close two workbooks working with VBA? I have tried following codes: Application.DisplayAlerts = False 'step 1 Windows("Book1.xls").Close 'step 2 Windows("Book2.xls").Close 'step 3 Application.DisplayAlerts = True 'step 4 Problem is, macro stops running after step 2! Thanks, Mischa |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing workbooks
Dear Tom,
I have tried you solution. Still does not work, note that the macro is in "Book3.xls". Running the macro from "book3.xls" to close "book2.xls" and "book1.xls" is this possible? Tkx, Mischa *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing workbooks
Shouldn't be a problem
On Error goto 0 Application.EnableEvents = False Workbooks("Book1.xls").Close SaveChanges:=False Workbooks("Book2.xls").Close SaveChanges:=False Application.EnableEvents = True -- Regards, Tom Ogilvy "anonymous" wrote in message ... Dear Tom, I have tried you solution. Still does not work, note that the macro is in "Book3.xls". Running the macro from "book3.xls" to close "book2.xls" and "book1.xls" is this possible? Tkx, Mischa *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing workbooks
Hi Mischa,
try this: Sub Macro1() ' ' Macro1 Macro ' Macro recorded 6/17/2004 by Unknown User ' ' Windows("Book1").Activate ActiveWindow.Close Windows("Book2").Activate ActiveWindow.Close End Sub HTH....Don "anonymous" wrote: Dear Tom, I have tried you solution. Still does not work, note that the macro is in "Book3.xls". Running the macro from "book3.xls" to close "book2.xls" and "book1.xls" is this possible? Tkx, Mischa *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Closing workbooks w/o closing Excel | Excel Discussion (Misc queries) | |||
close workbooks without closing excel ? | Excel Discussion (Misc queries) | |||
closing multi workbooks | Excel Discussion (Misc queries) | |||
Opening and Closing workbooks | Excel Programming | |||
Closing workbooks through macro | Excel Programming |