![]() |
|
#1
|
||||
|
||||
![]()
For that, you could use a macro like:
Code:
Sub Demo() Randomize Timer Dim StrTxt As String, StrTmp As String, StrOut As String Dim i As Long, j As Long With Selection.Range .Start = .Sentences.First.Start .End = .Sentences.First.End While .Characters.Last Like "[.!:;?" & vbCr & vbTab & vbLf & "]" .End = .End - 1 Wend StrTxt = " " & Trim(.Text) & " " While Len(Trim(StrTxt)) > 1 i = UBound(Split(StrTxt, " ")) + 1 j = Int(Rnd * i) If j > 0 Then StrTmp = Split(StrTxt, " ")(j) & " " StrOut = Trim(StrOut & " " & StrTmp) StrTxt = Replace(StrTxt, " " & StrTmp, " ", 1, 1) End If Wend .Text = StrOut End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Thanks the above works..
So what if I wanted it to run in every sentence in the file. Something like a for loop.. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
nrsmd | Word | 2 | 07-04-2015 10:33 PM |
![]() |
Andoheb | Word | 29 | 07-03-2014 01:48 PM |
![]() |
awolf | Word VBA | 7 | 03-16-2014 02:40 PM |
Space Between Each Sentence | dazwm | Word | 2 | 10-17-2012 04:19 AM |
![]() |
moreenz | Word | 3 | 08-16-2012 02:41 PM |