View Single Post
 
Old 11-17-2020, 06:21 AM
gmaxey gmaxey is offline Windows 10 Office 2016
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

Just tinkering and perhaps with some searching you may find something more complete but:

Code:
Sub StyleCheck_ContractionsTest()
Dim oRng As Range
Dim oRngEval As Range
  Set oRng = ActiveDocument.Range
  Selection.HomeKey Unit:=wdStory
  With oRng.Find
    .Text = "n't"
    .Wrap = wdFindStop
     While .Execute
       Set oRngEval = oRng.Words(1).Duplicate
       If oRngEval.Characters.Last = " " Then oRngEval.End = oRngEval.End - 1
       oRngEval.Select
       If MsgBox("Do you want to amend the selected contraction?", vbYesNo, "Convert") = vbYes Then
         MsgBox Left(oRngEval.Text, Len(oRngEval.Text) - 2)
         Select Case Left(oRngEval.Text, Len(oRngEval.Text) - 2)
           Case Is = "can": oRngEval.Text = "cannot"
           Case Is = "Can": oRngEval.Text = "Cannot"
           Case Is = "couldn": oRngEval.Text = "could not"
           Case Is = "Couldn": oRngEval.Text = "Could not"
           Case Is = "shouldn": oRngEval.Text = "should not"
           Case Is = "Shouldn": oRngEval.Text = "Should not"
           Case Is = "wouldn": oRngEval.Text = "would not"
           Case Is = "Wouldn": oRngEval.Text = "would not"
           Case Is = "won": oRngEval.Text = "will not"
           Case Is = "Won": oRngEval.Text = "will not"
           Case Is = "didn": oRngEval.Text = "did not"
           Case Is = "Didn": oRngEval.Text = "Did not"
           Case Is = "don": oRngEval.Text = "do not"
           Case Is = "Don": oRngEval.Text = "Do not"
         End Select
         oRng.Collapse wdCollapseEnd
       End If
     Wend
  End With
  MsgBox ("Complete!")
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote