J
JohnJack
Hi,
Yes I have read up on the different ways of doing this, but I always
come to the same problem.
In my current code I have the line
Application.Run ("T1Seed1.xls!Main")
Which works fine (it calls the "Main" macro in T1Seed2.xls). But once
the "main" macro is run, the rest of my current macro doesn't run.
Here is my code (missing some variables thata bit above, but thats
ok).
Dim ESDUFile, RootPath, WorkBookToOpen, SheetToOpen, BuildingHeight As
String
ESDUFile = Sheets("Rotate spf red").Cells(10, 9)
RootPath = ESDUFile
Do While Right(RootPath, 1) <> "\"
RootPath = Left(RootPath, Len(RootPath) - 1)
Loop
BuildingHeight = 225
SeedScale = 345
For A = 1 To NumTowers
For B = 1 To 2
SheetToOpen = "T" & A & "Seed" & B & ".xls"
WorkBookToOpen = RootPath & SheetToOpen
FileCopy ESDUFile, WorkBookToOpen
Range("C22:C57").Copy
Workbooks.Open WorkBookToOpen
Windows(SheetToOpen).Activate
Sheets("RWDI_Factors").Select
Range("H67").Select
ActiveSheet.Paste
Range("D7") = SeedScale
Range("D6") = BuildingHeight
Application.Run ("T1Seed1.xls!Main")
Sheets("Factors").Select
Application.CutCopyMode = False 'closes the clipboard with massive
amounts of data thus does not prompt to save or close
ActiveWorkbook.Close True ' false means not to save, true means to
save and close
Windows("MR_Setup_underDevelopment_profiles.xls").Activate
Next B
Next A
It works fine up until right after the Application.Run line where it
will not continue on (ie it will not select the "Factors" sheet or do
anything after).
Is there another way I can do this that will allow the original macro
to continue running after it calls the macro in the other workbook?
Any help would be appreciated.
Jack
Yes I have read up on the different ways of doing this, but I always
come to the same problem.
In my current code I have the line
Application.Run ("T1Seed1.xls!Main")
Which works fine (it calls the "Main" macro in T1Seed2.xls). But once
the "main" macro is run, the rest of my current macro doesn't run.
Here is my code (missing some variables thata bit above, but thats
ok).
Dim ESDUFile, RootPath, WorkBookToOpen, SheetToOpen, BuildingHeight As
String
ESDUFile = Sheets("Rotate spf red").Cells(10, 9)
RootPath = ESDUFile
Do While Right(RootPath, 1) <> "\"
RootPath = Left(RootPath, Len(RootPath) - 1)
Loop
BuildingHeight = 225
SeedScale = 345
For A = 1 To NumTowers
For B = 1 To 2
SheetToOpen = "T" & A & "Seed" & B & ".xls"
WorkBookToOpen = RootPath & SheetToOpen
FileCopy ESDUFile, WorkBookToOpen
Range("C22:C57").Copy
Workbooks.Open WorkBookToOpen
Windows(SheetToOpen).Activate
Sheets("RWDI_Factors").Select
Range("H67").Select
ActiveSheet.Paste
Range("D7") = SeedScale
Range("D6") = BuildingHeight
Application.Run ("T1Seed1.xls!Main")
Sheets("Factors").Select
Application.CutCopyMode = False 'closes the clipboard with massive
amounts of data thus does not prompt to save or close
ActiveWorkbook.Close True ' false means not to save, true means to
save and close
Windows("MR_Setup_underDevelopment_profiles.xls").Activate
Next B
Next A
It works fine up until right after the Application.Run line where it
will not continue on (ie it will not select the "Factors" sheet or do
anything after).
Is there another way I can do this that will allow the original macro
to continue running after it calls the macro in the other workbook?
Any help would be appreciated.
Jack