VB command in the "Control" file
Hi,
I have 3 very big Excel files and in each one of them there is a macro writing in VB. The files and there macro names: File name Macro name A1 ------------ Mac1 A2 ------------ Mac2 A3 ------------ Mac3 Because the files are very big I am: 1. Opening one file at a time 2. Activate his macro 3. Save, close and open the next one and so on My question: From a different Excel file, can I activate the macro in each one of the files (A1-A3)? Meaning: From a file call "Control" The macro in this file will be: - Open file A1 - Activate macro Mac1 - When finish, save and close the file - Continue the same with files A2 and A3 How can I do that? What will be the VB commands for the macro in the "Control" file? Thank you very much in advance, Haim. |
VB command in the "Control" file
You could easily change each file to run the macro by renaming each macro
Auto_Open. In the control file, just create a macro that opens each then closes it Workbooks.Open Filename:="A1.xls" ACtiveworkbook.Close etc. -- HTH RP "Haim" wrote in message ... Hi, I have 3 very big Excel files and in each one of them there is a macro writing in VB. The files and there macro names: File name Macro name A1 ------------ Mac1 A2 ------------ Mac2 A3 ------------ Mac3 Because the files are ver y big I am: 1. Opening one file at a time 2. Activate his macro 3. Save, close and open the next one and so on My question: From a different Excel file, can I activate the macro in each one of the files (A1-A3)? Meaning: From a file call "Control" The macro in this file will be: - Open file A1 - Activate macro Mac1 - When finish, save and close the file - Continue the same with files A2 and A3 How can I do that? What will be the VB commands for the macro in the "Control" file? Thank you very much in advance, Haim. |
VB command in the "Control" file
hi,
yes, you can do this. in a Blank workbook create macro and add code like this: sub mastermacro() ' or whatever Workbooks.Open Filename:="c:\temp\A1.xls" call mac1 activeworkbook.save activeworkbook.close Workbooks.Open Filename:="c:\temp\A2.xls" call mac2 activeworkbook.save activeworkbook.close Workbooks.Open Filename:="c:\temp\A3.xls" call mac3 activeworkbook.save activeworkbook.close I do something similar each morning except i do 10 files/macros. once started the macro must go to end. you cannot open file a1 and start macro mac1 then try to close the mastermacro file. crash and burn. for that reason it might be a good idea to copy all the macros to the mastermacro file. that is how i do my morning thing above. all the code is in one file. -----Original Message----- Hi, I have 3 very big Excel files and in each one of them there is a macro writing in VB. The files and there macro names: File name Macro name A1 ------------ Mac1 A2 ------------ Mac2 A3 ------------ Mac3 Because the files are very big I am: 1. Opening one file at a time 2. Activate his macro 3. Save, close and open the next one and so on My question: From a different Excel file, can I activate the macro in each one of the files (A1-A3)? Meaning: From a file call "Control" The macro in this file will be: - Open file A1 - Activate macro Mac1 - When finish, save and close the file - Continue the same with files A2 and A3 How can I do that? What will be the VB commands for the macro in the "Control" file? Thank you very much in advance, Haim. . |
All times are GMT +1. The time now is 09:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com