In case you have to append a comment to an HP ALM memo field, the following method might be of help.

Source Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
' @Author - Alexander Bolte
' @ChangeDate - 2014-10-31
' @Description - Appending a HTML comment to handed Bug object.
' After the comment is appended the changes are not committed in order
' to leave control for this step in calling procedure.
' @Param bg - a Bug object to update.
' @Param fieldName - database field name of a Memo field, to which
' a comment should be appended.
' @Param comentText - a comment to be appended.
Function appendComment(bg, fieldName, commentText)
  Dim tmpComment ' As String
 
  On Error Resume Next
 
  ' Get current comment text.
  tmpComment = bg.field(fieldName)
 
  ' Convert to HTML comment or prepare for append.
  If inStr(1,tmpComment,"<html>") <= 0 Then
     tmpComment = "<html><body><div><span>" & tmpComment & "</span></div>"
  Else
      tmpComment = Replace(tmpComment, "</body>", "")
      tmpComment = Replace(tmpComment, "</html>", "")
  End If
  ' Append a comment including timestamp.
  tmpComment = tmpComment & _
  "<div><span><font color=""#000080""><b>________________________________________<br/>" & _
  User.FullName & " &lt;" & User.UserName & "&gt;, " & _
  Now() & ":</b></font></span><font face=""Arial"" color=""#000000""><span>" & _
  Replace(Replace(commentText, Chr(10), "<br/>"), "%nl%", "<br/>") & _
  "</span></font></div></body></html>"
 
  bg.field(fieldName) = tmpComment  'BG_DESCRIPTION - SoD Comments
 
  If Err.Number <> 0 Then
     MsgBox "Uncatched exception (appendComment)." & Chr(10) & Chr(10) & _
            Err.Description, vbCritical, cDialogTitle
     Err.Clear
  End If
End Function