View Single Post
 
Old 01-08-2016, 06:52 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

I assume that you are aware that your code will not find three letter CAPS that start the document, end a sentence or paragraph
Code:
Sub DeleteCap3Word()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
  With oRng.Find
    .ClearFormatting
    .Text = " [A-Z]{3} "
    .Replacement.Text = " "
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchCase = True
    .MatchWholeWord = True
    .MatchWildcards = True
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    While .Execute
      Select Case Trim(oRng)
       Case "USB", "PSA"
       
       Case Else
         oRng.Text = " "
     End Select
     oRng.Collapse wdCollapseEnd
   Wend
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote