Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
crannard Absent Member.
Absent Member.
532 views

Extracting TRIM 'Record Actions' using VBA

Hi All

I was hoping that someone would be able to assist me with my below issue. I am looking to develop an excel template using VBA that loops through all documents saved in a TRIM container (i.e.2016/000001) and pulls the following information from the Properties > Record Actions view;

  1. Action (i.e. Approval/Authorisation);
  2. Estimated duration (for the action assigned or completed);
  3. Completed by location (who completed the action);
  4. Actual duration (how long it took to complete that action);
  5. Responsible location (work area responsible for completing the action);
  6. Status;
  7. Start date (when the action begins);
  8. Due date (when the action is due to be completed); and
  9. Completed on (when the action was completed)

I have tried using the 'Print Merge' function though the above fields are not able to be selected when executing. I have pasted some code below that extracts any record actions that have been assigned/completed though need to be able to incorporate the above:

Sub getrecordactions()

Dim RecNum As String

Dim db As TRIMSDK.Database

Dim oRecord As TRIMSDK.Record

Dim oRecordType As TRIMSDK.RecordType

Dim Actions As Variant

Dim RecActions As String

Dim i As Integer

Set db = New TRIMSDK.Database

Set oRecordType = db.GetRecordType("Document")

RecNum = "R16/755571" 'just a test record number

Set oRecord = db.GetRecord(RecNum)

'MsgBox oRecord.Actions 'gets Record Actions but won't split up fields

RecActions = oRecord.Actions

Excel.ActiveSheet.Activate

Actions = Split(RecActions, vbCr) 'splits the record actions based on enter 

For i = 0 To UBound(Actions)

    Cells(1, i + 1).Value = Actions(i) 'pastes each record action across cells

Next i

End Sub

Any help would be greatly appreciated! 

Thanks in advance.

Chris. 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.