Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default controlling macro execution

I have a group of excel files (about 50). Each of these excel files has a set
of 3 similar macros. Instead of opening each file and running the macros for
individual files, is there a way of automating or creating a master
file, that opens each file, calls its marcos, stores the results of the
macros
in the respective file, saves it before closing and then proceeds to call the
next file. Is there any simple way of doing this without changing the macros
in the individual files largely.

Secondly, is there a way i can write a routine such that if i were to make
changes to the macros in a file, it can be copied to all the other files,
after removing/replacing the older version of the same macro in the other
files.


any suggestions on these two questions will be of great help.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default controlling macro execution

One way to do it:

Name your workbooks with a sequential number such as
"Book1" , "Book2", ...... "Book50", etc
Plus a "Master" workbook.

In the Master wbk enter the following sub

Sub BatchRun()

Dim i As Integer

For i = 1 To 50
Workbooks.Open (ThisWorkbook.Path & "\Book" & i & ".xls")
'The individual Workbook_Open event will automatically run at this point
'Then save an close the workbook before going to the next wbk:
Workbooks("Book" & i & ".xls").Close True
Next i
End Sub


Then in each wbk 1...50
In the ThisWorkbook object enter:

Private Sub Workbook_Open()
'each of these macros are in a standard module local to it's own wbk
MyMacro1
MyMacro2
MyMacro3
End Sub






"sree" wrote:

I have a group of excel files (about 50). Each of these excel files has a set
of 3 similar macros. Instead of opening each file and running the macros for
individual files, is there a way of automating or creating a master
file, that opens each file, calls its marcos, stores the results of the
macros
in the respective file, saves it before closing and then proceeds to call the
next file. Is there any simple way of doing this without changing the macros
in the individual files largely.

Secondly, is there a way i can write a routine such that if i were to make
changes to the macros in a file, it can be copied to all the other files,
after removing/replacing the older version of the same macro in the other
files.


any suggestions on these two questions will be of great help.

Thanks

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
Macro Execution C Brandt Excel Discussion (Misc queries) 2 July 13th 07 07:23 AM
Controlling windows explorer with VB macro gauss1976 Excel Discussion (Misc queries) 0 July 27th 06 09:30 AM
automatic macro execution Jos reulen Excel Programming 4 November 10th 03 03:10 PM
Hiding macro execution Angeliki Excel Programming 4 November 7th 03 01:35 PM
slow macro execution Vasile Dumitrescu Excel Programming 1 October 7th 03 03:31 PM


All times are GMT +1. The time now is 07:18 PM.

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"