ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros across multiple files (https://www.excelbanter.com/excel-programming/363285-macros-across-multiple-files.html)

Peterhine21

Macros across multiple files
 
I have 6 files that i wish to open and run a macro on. I have set up another
file that contains a macro that is intended to runs all six. However it runs
through the macro in the first file and then finishes without starting the
second file.

I'm quite new to macros and obviously missing something here. Help !

Sub Update_PFT_Reports()
'
' Update_PFT_Reports Macro
' Macro recorded 01/06/2006 by Peter Hine
' ChDir "\\Havuksfp01\havantreporting\Daily_reporting\Curr ent"
' Keyboard Shortcut: Ctrl+Shift+U
'
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\Consolidated
PFT Daily report back up data.xls"
Application.Run _
"'Consolidated PFT Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\Blocks &
Ultronics Daily report back up data.xls"
Application.Run _
"'Blocks & Ultronics Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\4V3 & 4V5
Daily report back up data.xls"
Application.Run _
"'4V3 & 4V5 Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\Batch & Props
Daily report back up data.xls"
Application.Run _
"'Batch & Props Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\Hose Daily
report back up data.xls"
Application.Run _
"'Hose Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\MMVP Daily
report back up data.xls"
Application.Run _
"'MMVP Daily report back up data.xls'!Update_and_save"
End Sub

FSt1

Macros across multiple files
 
hi,
it would have helped if you had posted your code.
I did this once with 12 files.
I created a Master file that contained all of the 12 macros. i created a
13th macro that....
opened file 1 then called the macro that was supose to run in that file.
after running macro1 in file 1, the 13th macro saved and closed file1. it
then open file 2 and called macro2 and so on.

not that much help but maybe it'll give you the general idea.

regards
FSt1

"peterhine21" wrote:

I have 6 files that i wish to open and run a macro on. I have set up another
file that contains a macro that is intended to runs all six. However it runs
through the macro in the first file and then finishes without starting the
second file.

I'm quite new to macros and obviously missing something here. Help !

Sub Update_PFT_Reports()
'
' Update_PFT_Reports Macro
' Macro recorded 01/06/2006 by Peter Hine
' ChDir "\\Havuksfp01\havantreporting\Daily_reporting\Curr ent"
' Keyboard Shortcut: Ctrl+Shift+U
'
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\Consolidated
PFT Daily report back up data.xls"
Application.Run _
"'Consolidated PFT Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\Blocks &
Ultronics Daily report back up data.xls"
Application.Run _
"'Blocks & Ultronics Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\4V3 & 4V5
Daily report back up data.xls"
Application.Run _
"'4V3 & 4V5 Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\Batch & Props
Daily report back up data.xls"
Application.Run _
"'Batch & Props Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\Hose Daily
report back up data.xls"
Application.Run _
"'Hose Daily report back up data.xls'!Update_and_save"
Workbooks.Open Filename:= _
"\\Havuksfp01\havantreporting\Daily_reporting\Curr ent\MMVP Daily
report back up data.xls"
Application.Run _
"'MMVP Daily report back up data.xls'!Update_and_save"
End Sub



All times are GMT +1. The time now is 07:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com