Seamus2626
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
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
Please show the code from the first workbook.
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").Activ ate
Sheets("Month End").Visible = True
Sheets("Month End").Select
With ActiveSheet
etc etc
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
Call BringInRawData
'These spreadsheets are opened to ensure links are updated for Cash/Merit and TLM
Application.DisplayAlerts = False
Application.ScreenUpdating
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
'BringinAgeAnlaysis
Workbooks.Open Filename:= _
"G:\Asset Services Risk Team\KRI Raw Data\Merit.xls"
Windows("Merit.xls").Activ
Sheets("Month End").Visible = True
Sheets("Month End").Select
With ActiveSheet
etc etc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect, thats the problem, i can close the file afterwards
Cheers,
Seamus
Cheers,
Seamus