Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with Two WorkBooks
HI,
I'm a bit mixed up with running macros from other Workbooks. There are two workbooks open, say Book1 and Book2. At the end of a session, with Book2 being the active workbook, I want to run a macro (called, say ShutDown ) in Book1 which will then close Book2. I'm Ok after that. If it helps - Book1 is Workbooks(1) and Book2 is Workbooks(2) Any pointers please ? regards, Don -- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with Two WorkBooks
Donald,
I am assuming that the call to Shutdown is from a macro in Book2. If so, add this to your macro in Book2 Application.Run ("Book1!Shutdown") The shutdown macro would include this line of code Workbooks("Book2").Close If you want it to close without saving, precede by Workbooks("Book2").Saved = True If you want it to save Book2 without prompting you, precede by Application.DisplayAlerts = False and set to True afterwards. Hop I haven't mixed up Book1 and Book2. -- HTH Bob Phillips "Donald Lloyd" wrote in message ... HI, I'm a bit mixed up with running macros from other Workbooks. There are two workbooks open, say Book1 and Book2. At the end of a session, with Book2 being the active workbook, I want to run a macro (called, say ShutDown ) in Book1 which will then close Book2. I'm Ok after that. If it helps - Book1 is Workbooks(1) and Book2 is Workbooks(2) Any pointers please ? regards, Don -- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with Two WorkBooks
Nothing mixed up, Bob
That's great. Thank you, Don -- "Bob Phillips" wrote in message ... Donald, I am assuming that the call to Shutdown is from a macro in Book2. If so, add this to your macro in Book2 Application.Run ("Book1!Shutdown") The shutdown macro would include this line of code Workbooks("Book2").Close If you want it to close without saving, precede by Workbooks("Book2").Saved = True If you want it to save Book2 without prompting you, precede by Application.DisplayAlerts = False and set to True afterwards. Hop I haven't mixed up Book1 and Book2. -- HTH Bob Phillips "Donald Lloyd" wrote in message ... HI, I'm a bit mixed up with running macros from other Workbooks. There are two workbooks open, say Book1 and Book2. At the end of a session, with Book2 being the active workbook, I want to run a macro (called, say ShutDown ) in Book1 which will then close Book2. I'm Ok after that. If it helps - Book1 is Workbooks(1) and Book2 is Workbooks(2) Any pointers please ? regards, Don -- |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Working with Two WorkBooks
Just a further small query -
Application.Run("Book1!Shutdown") What would the format be if referring to Book1 by its Index ? regards, Don -- "Bob Phillips" wrote in message ... Donald, I am assuming that the call to Shutdown is from a macro in Book2. If so, add this to your macro in Book2 Application.Run ("Book1!Shutdown") The shutdown macro would include this line of code Workbooks("Book2").Close If you want it to close without saving, precede by Workbooks("Book2").Saved = True If you want it to save Book2 without prompting you, precede by Application.DisplayAlerts = False and set to True afterwards. Hop I haven't mixed up Book1 and Book2. -- HTH Bob Phillips "Donald Lloyd" wrote in message ... HI, I'm a bit mixed up with running macros from other Workbooks. There are two workbooks open, say Book1 and Book2. At the end of a session, with Book2 being the active workbook, I want to run a macro (called, say ShutDown ) in Book1 which will then close Book2. I'm Ok after that. If it helps - Book1 is Workbooks(1) and Book2 is Workbooks(2) Any pointers please ? regards, Don -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Merging WorkBooks Not Working | Excel Discussion (Misc queries) | |||
working with excel 97 workbooks | Excel Discussion (Misc queries) | |||
Working on Multiple Workbooks | Excel Discussion (Misc queries) | |||
Working with Different workbooks | Excel Discussion (Misc queries) | |||
Working with Different workbooks | Excel Discussion (Misc queries) |