Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"FILE" command on the tool bar is missing - how do I recover it Willsecur Excel Discussion (Misc queries) 3 May 16th 07 10:24 PM
Scroll Bar missing "Control" tab in "Format Properties" dialog box Peter Rooney Excel Discussion (Misc queries) 5 August 24th 06 05:36 PM
Removing "Save As" Command from an excel file. Camper Joe Excel Worksheet Functions 0 December 19th 05 03:00 PM
Excel VBA File Search Command Cannot "See" VBA Project Name gfhunt Excel Programming 0 May 23rd 04 04:36 AM
"Go ahead and replace file" command? Ed[_9_] Excel Programming 2 October 7th 03 04:14 PM


All times are GMT +1. The time now is 03:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"