Create an alert on a defect
Public Sub CreateAlert()

' Create an Alert on a defect

    Dim Alrt As Alert
    Dim Alrtable As IAlertable2
    Dim bFact As BugFactory
    Dim bList As IList
    Dim bg As Bug
    Dim bID As Integer
    ' Get the first bug in the project.
    Set bFact = tdc.BugFactory
    Set bList = bFact.NewList("")
    Set bg = bList(1)
    bID = bg.ID
    ' Cast the Bug object to IAlertable2.
    Set Alrtable = bg
    'Create the alert.
    Set Alrt = Alrtable.AddAlert("BUG", bID, "Bug Alert", "Take care of this.")
    With Alrt
        Debug.Print .Subject & ", " & .AlertType & ", " & .Unread
    End With

End Sub