LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default My Macro keeps stopping??

Hi All

I have a macro in one workbook, which opens lots of other workbooks:-
Sub Auto_Open()
' 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 Auto_Open 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 Auto_Open macro in the workbooks that are opened looks like this:-
Sub Auto_Open()
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 Auto_Open 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



 
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
stopping code Jase Excel Discussion (Misc queries) 1 October 6th 08 05:42 PM
Stopping a formula Roachy Excel Discussion (Misc queries) 3 July 1st 08 03:31 PM
Protect macro from stopping saman110 via OfficeKB.com Excel Discussion (Misc queries) 1 August 16th 07 08:22 PM
Stopping Excel macro pattern recgonition mal1920 New Users to Excel 2 November 17th 05 05:10 AM
Stopping a macro without using Ctrl Break Julian[_2_] Excel Programming 1 October 27th 03 02:39 AM


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

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

About Us

"It's about Microsoft Excel"