Further to my other post ‘I just can’t figure it out…’(I’m trying to set a field so that the newest value appears at the top - maybe it will work if I turn my monitor upside down?)
Now, I tried to get the value from the field, set it to blank, then loop through the existing values and put them in in the right order…
However, now I am getting subscript out of range, when it gets to number one.
Here’s the code:
Sub Initialize
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
'Call uidoc.Save
Dim Doc As NotesDocument
Set Doc = uidoc.Document
Dim tMainProjectPhase As Variant
tMainProjectPhase = doc.MainprojectPhase
Dim strMainProjectPhase As String
strMainProjectPhase = Cstr(tMainProjectPhase(0))
Dim user As String
user = session.CommonUserName
Dim GetValue As Variant
GetValue = doc.StatusLog
Call uidoc.FieldSetText("StatusLog","")
Elements1= Evaluate(|@Elements(StatusLog)|,doc)
'Call uidoc.Reload
Call uidoc.FieldAppendText _
( "StatusLog", "," )
Call uidoc.FieldAppendText _
( "StatusLog", "The project status was changed from " + Cstr(currentStatus) + " to " + NewStatus + " by " + user + " on " +Cstr(Date) + " at " + Cstr(Time) + ".")
Call uidoc.FieldAppendText _
( "StatusLog", "," )
Cstr1 = Cstr(Elements1(0))
'Cval1 = Cval(CStr1)
For x = 0 To Cstr1
Call uidoc.FieldAppendText _
( "StatusLog", GetValue(x))
Next
Call uidoc.Save
Call Doc.Save(True,True)
End Sub
Any ideas? Here’s the line it bugs out on:
For x = 0 To Cstr1
Call uidoc.FieldAppendText _
( "StatusLog", GetValue(x))