Link to home
Start Free TrialLog in
Avatar of Seamus2626
Seamus2626Flag for Ireland

asked on

Running a sub in a sub

Hi,

I have some code that opens another workbook. That workbook has code that activates on workbook opening.

The code from my original module stops once the code from the second workbook finishes running

How can i get my original code to resume?

Thanks
Seamus
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Please show the code from the first workbook.
Avatar of Seamus2626

ASKER

The problem arises when

Cognos Cash Nostro.xls opens. This has the code inside thisworkbook

Thanks
Seamus






Sub Increment()

'This has been written by Seamus on the 15/06/2011
'Points to note:

'(1) Due to the use of activate next window, it is important  to run this code with no other windows open
'(2) The locations for all of the below files are:

' - G:\Asset Services Risk Team\KRI Raw Data
' - G:\Asset Services Risk Team\Month End KRI Data


'This Sub brings in the file with throughput/brightlines etc


Dim PctDone                 As Single
Dim x                       As Long

x = 1

Application.DisplayAlerts = False

Application.ScreenUpdating = False





Call BringInRawData

'These spreadsheets are opened to ensure links are updated for Cash/Merit and TLM

Application.DisplayAlerts = False

Application.ScreenUpdating = False
   
    Workbooks.Open Filename:= _
        "G:\Asset Services Risk Team\KRI Raw Data\Cognos Cash Nostro.xls"
       
        Windows("Cash Nostro.xls").Activate
       
              ActiveWorkbook.UpdateLink Name:= _
        "H:\Asset Services Risk Team\KRI Raw Data\Cognos Cash Nostro.xls", Type:=xlExcelLinks
     
   
     ActiveWindow.Close
       
        Windows("Update File.xls").Activate
           
         

       
Application.DisplayAlerts = False

Application.ScreenUpdating = False
       
       
   'BringinAgeAnlaysis
       
       
     
            Workbooks.Open Filename:= _
        "G:\Asset Services Risk Team\KRI Raw Data\Merit.xls"
       
        Windows("Merit.xls").Activate
               
        Sheets("Month End").Visible = True
        Sheets("Month End").Select
   
        With ActiveSheet
       
etc etc
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect, thats the problem, i can close the file afterwards

Cheers,
Seamus