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.FunctionappendComment(bg,fieldName,commentText)DimtmpComment' As StringOnErrorResumeNext' Get current comment text.tmpComment=bg.field(fieldName)' Convert to HTML comment or prepare for append.IfinStr(1,tmpComment,"<html>")<=0ThentmpComment="<html><body><div><span>"&tmpComment&"</span></div>"ElsetmpComment=Replace(tmpComment,"</body>","")tmpComment=Replace(tmpComment,"</html>","")EndIf' Append a comment including timestamp.tmpComment=tmpComment&_"<div><span><font color=""#000080""><b>________________________________________<br/>"&_User.FullName&" <"&User.UserName&">, "&_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 CommentsIfErr.Number<>0ThenMsgBox"Uncatched exception (appendComment)."&Chr(10)&Chr(10)&_Err.Description,vbCritical,cDialogTitleErr.ClearEndIfEndFunction