S
Sh0t2bts
Hi All
I have a macro in one workbook, which opens lots of other workbooks:-
Sub Aut
pen()
' Turn Off Auto Calcs....
With Application
.Calculation = xlManual
.CalculateBeforeSave = False
End With
' Open First workbook
Workbooks.Open(Filename:= _
"M&G.xls", UpdateLinks:=0 _
).RunAutoMacros Which:=xlAutoOpen
'Open Second workbook.
Workbooks.Open(Filename:= _
"ET.xls", UpdateLinks:=0 _
).RunAutoMacros Which:=xlAutoOpen
It does the first bit and opens the first workbook, the first workbook once open runs and Aut
pen macro does it's bit and then closes that Active window,
all is fine at this point the macro then comes back into this macro, where it should open the second workbook but it fails and the macro stops running
The Aut
pen macro in the workbooks that are opened looks like this:-
Sub Aut
pen()
do_i_run = Workbooks("Run All Service
Tracking.xls").Worksheets("Sheet1").Range("A15")
If (What_Date_Did_I_Run = What_Was_I_Opened) Then
If do_i_run = 10 Then
ActiveWorkbook.Close
End If
End If
This is to just get the workbooks to close for testing.
The reason I need this is that I have 12 workbooks that I need to open and runn Aut
pen macros, the macros collect data from one of our SQL servers, as I have 12 of these and I can only run one at a time I need them to run one after another, I can not use scheduler as I do not know if the data collection from the SQL box wll take 1 minute or 10 minutes, it just depends on how many users are connected to it when I try to run my work.
Can someone advise how to get my macro to continue to run
OR
How I could get one workbook to open once the previouse one has ran?
Many Thanks
Mark
I have a macro in one workbook, which opens lots of other workbooks:-
Sub Aut
' Turn Off Auto Calcs....
With Application
.Calculation = xlManual
.CalculateBeforeSave = False
End With
' Open First workbook
Workbooks.Open(Filename:= _
"M&G.xls", UpdateLinks:=0 _
).RunAutoMacros Which:=xlAutoOpen
'Open Second workbook.
Workbooks.Open(Filename:= _
"ET.xls", UpdateLinks:=0 _
).RunAutoMacros Which:=xlAutoOpen
It does the first bit and opens the first workbook, the first workbook once open runs and Aut
all is fine at this point the macro then comes back into this macro, where it should open the second workbook but it fails and the macro stops running
The Aut
Sub Aut
do_i_run = Workbooks("Run All Service
Tracking.xls").Worksheets("Sheet1").Range("A15")
If (What_Date_Did_I_Run = What_Was_I_Opened) Then
If do_i_run = 10 Then
ActiveWorkbook.Close
End If
End If
This is to just get the workbooks to close for testing.
The reason I need this is that I have 12 workbooks that I need to open and runn Aut
Can someone advise how to get my macro to continue to run
OR
How I could get one workbook to open once the previouse one has ran?
Many Thanks
Mark