![]() |
|
#2
|
||||
|
||||
|
Replacing randomly is once thing, ensuring balanced percentages amongst the replacements is quite another. For the random replacements, you could use a macro like:
Code:
Sub CheckTherefore()
Application.ScreenUpdating = False
Randomize Timer
Dim strWords As String, i As Long, j As Long, k As Long, bCap As Boolean
strWords = "therefore,in other words,hence,so we can conclude that," & _
"on this basis we conclude that,that is,so we conclude that"
i = UBound(Split(strWords, ",")) + 1
With ActiveDocument.Range
With .Find
.Text = "therefore"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.Execute
End With
Do While .Find.Found
bCap = (UCase(.Characters.First) = .Characters.First)
Do While j = k
j = Int(Rnd() * i)
Loop
.Text = Split(strWords, ",")(j)
k = j
If bCap = True Then .Characters.First = UCase(.Characters.First)
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = False
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Control replacement font in advance? | Katten03 | Word | 6 | 07-13-2016 04:24 AM |
automatic entering of multiple words
|
cliff@tauruscommercial.ca | Word | 5 | 06-03-2014 06:06 PM |
| VBS Image Replacement - Appearing as Gray Box with Filename | Twily | Office | 1 | 09-12-2013 11:12 PM |
| Replacement | lostsoul62 | Excel | 0 | 04-14-2012 10:07 AM |
| Replacement Software | hirize | Office | 0 | 08-28-2008 02:33 PM |