ALM缺陷列表失败并显示“未定义用户定义类型”

时间:2016-12-29 07:09:13

标签: excel-vba alm vba excel

我想使用过滤条件提取缺陷列表。我尝试了来自OTA here的VBA代码,但是在用户定义类型未定义的情况下,编译在以下声明中失败:

Dim BugFact As BugFactory
Dim BugFilter As TDFilter
Dim bugList As List
Dim theBug As Bug

注意:我没有ALM的管理权限。

完整的VBA代码:

Sub BugFilter()

    Dim BugFact As BugFactory
    Dim BugFilter As TDFilter
    Dim bugList As List
    Dim theBug As Bug
    Dim i%, msg$

' Get the bug factory filter.
    'tdc is the global TDConnection object.
    Set BugFact = tdc.BugFactory
    Set BugFilter = BugFact.Filter

' Set the filter values.
    BugFilter.Filter("BG_STATUS") = "Closed"
    BugFilter.order("BG_PRIORITY") = 1
    MsgBox BugFilter.Text

'Create a list of defects from the filter
' and show a few of them.
    Set bugList = BugFilter.NewList
    msg = "Number of defects = " & bugList.Count & Chr(13)
    For Each theBug In bugList
       msg = msg & theBug.ID & ", " & theBug.Summary & ", " _
          & theBug.Status & ", " & theBug.Priority & Chr(13)
       i = i + 1
       If i > 10 Then Exit For
    Next
    MsgBox msg

End Sub

1 个答案:

答案 0 :(得分:1)

您需要添加对 OTA COM类型库的引用(请参阅here);否则,您的程序将无法了解OTA类型,例如BugFactoryTDFilter