Get requirement history
Public Sub GetReqHistory(theReq As Req) ' Getting an AuditRecordFactory for a specific object Dim currAuditable As IAuditable 'Cast the requirement object passed to the routine ' to an IAuditable reference. Set currAuditable = theReq Dim AuditRecF As AuditRecordFactory ' The AuditRecordFactory handles records of the original object. Set AuditRecF = currAuditable.AuditRecordFactory Dim recsList As TDAPIOLELib.List Set recsList = AuditRecF.NewList("") Debug.Print theReq.ID, theReq.Name Dim j As Integer, k As Integer ' Output the Audit Log records. For j = 1 To recsList.Count Dim AuditRec As AuditRecord Dim UsrName As String Dim thedate As Date Set AuditRec = recsList.Item(j) UsrName = AuditRec.UserName thedate = AuditRec.Time Debug.Print "----------------------------------" Debug.Print "EntityID = " & AuditRec.entityID & ", ActionID = " & AuditRec.actionID; "" Debug.Print "User = " & UsrName & ", Action Time = " & thedate & "" ' Output the Audit properties. Dim AuditPropF As AuditPropertyFactory Set AuditPropF = AuditRec.AuditPropertyFactory Dim propsList As TDAPIOLELib.List Set propsList = AuditPropF.NewList("") Dim oldValue As String, newValue$, msg$ msg = "Old Value New Value" Debug.Print msg For k = 1 To propsList.Count Dim AuditProp As AuditProperty Set AuditProp = propsList.Item(k) oldValue = AuditProp.oldValue oldValue = """" & oldValue & """" ' Pad for display Do While Len(oldValue) < 15 oldValue = oldValue & " " Loop newValue = AuditProp.newValue newValue = """" & newValue & """" ' Pad for display Do While Len(newValue) < 15 newValue = newValue & " " Loop Dim aID As Long, cTime As Date cTime = AuditProp.Time aID = AuditProp.actionID msg = oldValue & newValue & "ActionID = " & CStr(aID) & ", TimeStamp = " & CStr(cTime) Debug.Print msg Next k Next j End Sub