
OpenNTF Code Bin
About This Code
Brief Description:
Sort NotesOutline
Contributor:
Andrew Jones
Last Modified:
17 Jun 2002
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Sub OutlineSort ( outline As NotesOutline, strParent As String)
'This routine sorts the outline in alphabetical order
Dim swap As Integer
Dim found As Integer
Dim bFound As Integer
Dim currententry As NotesOutlineEntry
Dim nextentry As NotesOutlineEntry
Dim rootentry As NotesOutlineEntry
bFound = False
Set rootentry = outline.GetFirst()
While Not rootentry Is Nothing And Not bFound
If rootentry.Label = strParent Then
bFound = True
End If
If Not bFound Then
Set rootentry = outline.GetNextSibling(rootentry)
End If
Wend
If strParent <> "" And Not bFound Then
Exit Sub 'Parent entry not found
End If
top:
swap = False
If strParent <> "" Then
Set currententry = outline.GetChild(rootentry)
Set nextentry = outline.GetNextSibling(currententry)
Else
Set currententry = outline.GetFirst()
Set nextentry = outline.GetNextSibling(currententry)
End If
While Not (currententry Is Nothing) And Not (nextentry Is Nothing) And swap <> True
If currententry.Label > nextentry.Label Then
Call outline.Moveentry(currententry , nextentry, True, False)
swap = True
End If
Set currententry = outline.GetnextSibling(currententry )
Set nextentry = outline.GetnextSibling(nextentry )
Wend
If swap Then
Goto top
End If
outline.save
End Sub
Usage / Example
Comments
Posted by Urs Meli on 11/15/2004 09:55:24 AMTechtarget
Seems to be from Techtarget
http://searchdomino.techtarget.com/tip/1,289483,sid4_gci762580,00.html?Offer