Sub Get_Results() Dim td As New TDConnection td.InitConnectionEx "__________" td.ConnectProjectEx "______", "_____________", "____", "_________" Dim tset As TestSet Dim tstestfact As TSTestFactory Dim tstest As tstest Dim tlist As List Dim mytest As Test Dim myStepFact As StepFactory Dim mystep As DesignStep Dim runfact As RunFactory Dim runlist As List Dim rowcount As Long Dim rng As Range Set rng = Worksheets("Sheet1").Range("A1:A1") Set tsfact = td.TestSetFactory Dim TestSetID As Long TestSetID = xxxxxxx Set tset = tsfact.Item(TestSetID) Set tstestfact = tset.TSTestFactory Set tlist = tstestfact.NewList("") rowcount = 0 For Each tstest In tlist Set runfact = tstest.RunFactory Set runlist = runfact.NewList("") For Each myrun In runlist Set myStepFact = myrun.StepFactory Set StepList = myStepFact.NewList("") For Each mystep In StepList rng.Offset(rowcount, 0) = myrun.TestSource rng.Offset(rowcount, 1) = mystep.StepName rng.Offset(rowcount, 2) = mystep.Field("ST_STATUS") rng.Offset(rowcount, 3) = mystep.Field("ST_DESCRIPTION") rng.Offset(rowcount, 4) = mystep.Field("ST_EXPECTED") rng.Offset(rowcount, 5) = mystep.Field("ST_ACTUAL") rowcount = rowcount + 1 Next rowcount = rowcount + 1 Next rowcount = rowcount + 1 Next td.Logout td.Disconnect td.ReleaseConnection Set td = Nothing End Sub
You almost have it. Just replace DesignStepFactory with StepFactory, but to get to that you need the TSTest and Run objects. This code has not been tested and is probably not complete. In Excel, I like to use range offsets to output multiple rows. It's a lot cleaner code.