Hi,
well i'm looking for a way to reverse text strings in big word file but for each paragraph not for all text at one same time
i found this macro below but it reverses all text in one time
for ex:
this text
turns into
A truck is on a motorway in China the truck has millions of bees on it.
The bees fly everywhere. The police close the motorway.
The beehives are all over the motorway.
motorway. the over all are beehives motorway.
The the close police The everywhere. fly bees it.
The on bees of millions has truck the China in motorway a on is truck A
but i want it to be like:
it. on bees of millions has truck the China in motorway a on is truck A
motorway. the close police The everywhere. fly bees The
motorway. the over all are beehives The
like to be read from right to left instead of reading left to right
Sub ReverseWords() Dim strIn As Variant, strOut As String, lngIndex As Long 'Get the selected text, split by blanks into words strIn = Split(Selection) 'Construct the output string For lngIndex = 0 To UBound(strIn) strOut = strIn(lngIndex) & " " & strOut Next 'Replace the selected text Selection = Trim(strOut) lbl_Exit: Exit Sub End Sub Sub TransposeText() Dim oRng As word.Range Dim lngCase As Long Dim strText As String Dim lngIndex As Long Dim bSpace As Boolean With Selection If .Words.Count = 1 Then Set oRng = .Range lngCase = oRng.Words(1).Case strText = StrReverse(oRng.text) oRng.text = strText oRng.Case = lngCase Else Set oRng = .Range For lngIndex = 1 To oRng.Words.Count If oRng.Words(lngIndex).Characters.Last = Chr(32) Then bSpace = True lngCase = oRng.Words(lngIndex).Case strText = StrReverse(Trim(oRng.Words(lngIndex).text)) If bSpace Then strText = strText & " " oRng.Words(lngIndex).text = strText bSpace = False Next End If End With lbl_Exit: Exit Sub End Sub
and Thanks in advance


Reply With Quote
