View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Passing Control when workbooks have the same name

hi,
1.The workbook that contains the running macro must remain open.
2.You can run another macro in another workbook but the 1st workbook must
remain open because basicly the first macro called the second macro and
paused while the second macro ran. techniquely the first macro is still
running because it hasn't got to end sub yet. the call basicly inserted more
code into the running macro.
3.you can open another workbook and run a macro in the first workbook that
manipulated data in the second workbook but the first workbook cannot be
closed.

If you are thinking of manipulated several workbooks at a time, it would be
best to do what i did. create a special workbook that contains only macro.
open the macro workbook and run the macros that manipulates all the files.you
can write a macro that calls all the other macros.

my macro workbook fires at 5 in the morning(while i'm still at home asleep)
then runs 11 defferent macros that downloads data from the mainframe then
manipulates this data in 11 different files. Reports are on the printer when
i get to work. the 11 different files contain no macros because they are not
needed.

a word of caution. if you do have workbook with the same name.... you may
run into problems. i don't know what because i have never tried to open two
workbooks with the same name but that sounds risky.

good luck

FSt1



"shawb" wrote:


Basically I have several workbooks with the same name in different
directories for consistency reasons in my organization.

Is it possible from within one of these workbooks to close itself, and
open up another workbook (with the same name but in a different
directory) using a macro.

Or alternatively is it possible to execute a macro in another workbook
from the macros in a workbook? (Ie to temporarily pass control to a
third workbook that closes the current workbook and opens the desired
workbook).

Cheers


--
shawb
------------------------------------------------------------------------
shawb's Profile: http://www.excelforum.com/member.php...o&userid=14204
View this thread: http://www.excelforum.com/showthread...hreadid=390893