![]() |
|
#1
|
|||
|
|||
![]()
I have a script for reversing letters in words
Sub ReverseWords() Dim i As Long Dim OldString As Variant Dim RevText As Variant OldString = Split(Selection.Text, " ") For i = 0 To UBound(OldString) OldString(i) = StrReverse(OldString(i)) Next RevText = Join(OldString, " ") MsgBox RevText End Sub But the result just show in message window. Is that possible to change that code that reversed text replaced marked text? |
#2
|
||||
|
||||
![]()
Replace:
MsgBox RevText with: Selection.Text = RevText
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Thanks. Is that possible to do something for reversing order of words in the sentence?
|
#4
|
||||
|
||||
![]()
You could use something like:
Code:
Sub Reverse() Dim i As Long Dim OldString As Variant Dim RevText As Variant OldString = Split(Selection.Text, " ") For i = 0 To UBound(OldString) RevText = OldString(i) & " " & RevText Next Selection.Text = RevText End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Thanks a lot
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compare text from Bookmark with text from Text box | Byron Polk | Word VBA | 4 | 07-30-2014 06:18 AM |
Reversing Formatted Fractions? | Rusty123 | Word | 1 | 03-05-2012 05:44 PM |
Column/row reversing in excel | pban92 | Excel | 2 | 01-26-2011 12:00 PM |
![]() |
clients | PowerPoint | 1 | 09-28-2010 08:49 PM |
![]() |
weemikey | Word | 4 | 08-05-2009 11:10 AM |