Sub paras() Dim iLower As Integer, iUpper As Integer, iCount As Integer, temp As String Dim p As word.Paragraph Dim txt As Variant Dim w As Integer Dim str As String Dim i As Integer Dim j As Integer Dim rng As String Dim iparCount As Integer Dim strArray As Range Dim sArray Dim sMyPara As String w = ActiveDocument.Range.words.count iparCount = ActiveDocument.Paragraphs.count For i = 1 To iparCount sMyPara = ActiveDocument.Paragraphs(i).Range.text Set strArray = ActiveDocument.Paragraphs(i).Range sArray = Split(strArray, ",") iUpper = UBound(sArray) iLower = 1 Dim bSorted As Boolean bSorted = False Do While Not bSorted bSorted = True For iCount = iLower To iUpper - 1 str2 = StrComp(sArray(iCount), sArray(iCount + 1), vbTextCompare) If str2 = 1 Then temp = sArray(iCount + 1) sArray(iCount + 1) = sArray(iCount) sArray(iCount) = temp bSorted = False End If Next iCount iUpper = iUpper - 1 Loop rng = sArray(iCount) Next i End Sub
strArray
Range
String
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)