Sub CitationListSortByName() ' Paul Beverley - Version 10.04.24 ' Sorts items in a citation list in the text by name. sortReversed = False If Selection.Start = Selection.End Then Selection.MoveStartUntil cset:="(", Count:=wdBackward Selection.MoveEndUntil cset:=")", Count:=wdForward Else theEnd = Selection.End Selection.Collapse wdCollapseStart Selection.Expand wdWord theStart = Selection.Start Selection.End = theEnd Selection.Collapse wdCollapseEnd Selection.Expand wdWord Do While InStr(ChrW(8217) & "' ", Right(Selection.Text, 1)) > 0 Selection.MoveEnd , -1 DoEvents Loop Selection.Start = theStart End If myList = Selection myDelim = ", " If InStr(myList, ";") > 0 Then myDelim = "; " myBits = Split(myList, myDelim) lastItem = UBound(myBits) ReDim myGroup(lastItem) As String myGroup = myBits If sortReversed Then WordBasic.SortArray myGroup(), 1 Else WordBasic.SortArray myGroup(), 0 End If tempStr = "" For i = 0 To lastItem - 1 tempStr = tempStr & myGroup(i) & myDelim Next i tempStr = tempStr & myGroup(i) Selection.TypeText tempStr End Sub