我会创建一个自定义类:
  public class TripleText
   private v1 as string
   private v2 as string
   private v3 as string
   sub new(s1 as string, s2 as string, s3 as string)
     v1 = s1
     v2 = s2
     v3 = s3
   end sub
   property get value1 as string
    value1 = v1
   end property
   property get value2 as string
    value2 = v2
   end property
   property get value3 as string
    value3 = v3
   end property
  end class
然后我会创建一个数组:
  dim sortMe(4) as TripleText
填充它:
  dim text1 as variant
  dim text2 as variant
  dim text3 as variant
  text1 = doc.getItemValue("textList1")
  text2 = doc.getItemValue("textList2")
  text3 = doc.getItemValue("textList3")
  for i = 0 to 4
   sortMe(i) = new TripleText(text1(i),text2(i),text3(i))
  next
现在您所要做的就是对 SortMe 数组进行排序。您可以在此处找到 LotusScript 中的示例 QuickSort 实现,经过一些重写以使其适用于 TripleText,您只需调用它:
dim Sorted(4) as TripleText Sorted = QuickSort(SortMe)   
链接的 QuickSort 实现对字符串数组进行排序,并且您有一个 TripleText 数组。这就是为什么我说会有一些重写来适应它,但是修改代码很容易,以便它接受一个 TripleText 数组并根据 value1 属性对其进行排序。即,我不会为您重写所有代码,但关键是不要像这样进行比较:
If sA(i) < PivotValue Then
你会这样做:
If TT(i).value1 < PivotValue Then
交换,或当然,处理包含所有三个值的整个 TripleText 对象,而不仅仅是 value1。
(我将 SA 重命名为 TT,因为我认为 SA 代表“字符串数组”。如果我要窃取此代码,我肯定会费心重命名以使其适合我的目的。)
最后,一旦您调用了 QuickSort 并以正确的顺序获取了 SortMe 数组,您只需将 TripleText 数组中的值提取回字符串数组,然后使用 ReplaceItemValue 将这些字符串数组放回 NotesItems :
  for i = 0 to 4
   text1(i) = sortMe(i).value1
   text2(i) = sortMe(i).value2
   text3(i) = sortMe(i).value3
  next
  doc.ReplaceItemValue("TextList1",text1)
  doc.ReplaceItemValue("TextList2",text2)
  doc.ReplaceItemValue("TextList3",text3)