Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Execution | Excel Discussion (Misc queries) | |||
Controlling windows explorer with VB macro | Excel Discussion (Misc queries) | |||
automatic macro execution | Excel Programming | |||
Hiding macro execution | Excel Programming | |||
slow macro execution | Excel Programming |