Hi Chept ,
Try the below
Sub DefectLinks()
Dim QcConnection As Object
Dim QcUrl As String
Dim QcUser As String
Dim QcPassword As String
Dim QcDomain As String
Dim QcProject As String
QcUrl = ""
QcUser = ""
QcPassword = ""
QcDomain = ""
QcProject = ""
Set QcConnection = CreateObject("TDApiOle80.TDConnection")
QcConnection.InitConnectionEx QcUrl
QcConnection.Login QcUser, QcPassword
QcConnection.Connect QcDomain, QcProject
MsgBox ("Login successfull")
Dim ABug
Dim BgFact As BugFactory
Dim BgLst As List
Dim LkFact As LinkFactory
Dim ILnk As ILinkable
Dim LnkLst As List
Set BgFact = QcConnection.BugFactory
Set BgLst = BgFact.NewList("")
For Each ABug In BgLst
Set ILnk = ABug
Set LkFact = ILnk.LinkFactory
Set LnkLst = LkFact.NewList("")
Dim Excel As Object
Dim Sheet
Dim Row
Dim Lnk As Link
Set Excel = CreateObject("Excel.Application")
Excel.Visible = True
Excel.Workbooks.Add
Set Sheet = Excel.ActiveSheet
Sheet.Name = "Defects"
With Sheet.Range("A1:H1")
.Font.Name = "Arial"
.Font.FontStyle = "Bold"
.Font.Size = 10
.Font.Bold = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Interior.ColorIndex = 15
End With
Sheet.Cells(1, 1) = "Created By"
Sheet.Cells(1, 2) = "Creation Date"
Sheet.Cells(1, 3) = "Bug ID"
Sheet.Cells(1, 4) = "Link Comment"
Sheet.Cells(1, 5) = "Link Id"
Sheet.Cells(1, 6) = "Link Type"
Sheet.Cells(1, 7) = "Entity ID"
Sheet.Cells(1, 8) = "Entity Type"
Row = 2
For Each Lnk In LnkLst
Sheet.Cells(Row, 1).Value = Lnk.Field("LN_CREATED_BY")
Sheet.Cells(Row, 2).Value = Lnk.Field("LN_CREATION_DATE")
Sheet.Cells(Row, 3).Value = Lnk.Field("LN_BUG_ID")
Sheet.Cells(Row, 4).Value = Lnk.Comment
Sheet.Cells(Row, 5).Value = Lnk.Field("LN_LINK_ID")
Sheet.Cells(Row, 6).Value = Lnk.LinkType
Sheet.Cells(Row, 7).Value = Lnk.Field("LN_ENTITY_ID")
Sheet.Cells(Row, 8).Value = Lnk.LinkedByEntity
Row = Row + 1
Next Lnk
Next ABug
Excel.ActiveWorkbook.SaveAs ("C:\Users_" & QcProject & "_links.xls")
Excel.Quit
QcConnection.Disconnect
QcConnection.Logout
End Sub
Thanks,
Avi.