Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-22-2014, 05:59 AM
macropod's Avatar
macropod macropod is offline Automatic Words replacement Windows 7 64bit Automatic Words replacement Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,516
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
Theoretically, in a large document, the relative frequency of and given replacement will usually be within one standard deviation of the average.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Control replacement font in advance? Katten03 Word 6 07-13-2016 04:24 AM
Automatic Words replacement 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft