A family of Microsoft word processing software products for creating web, email, and print documents.
To use the macro (which I have not tested) with my batch add-in, it would have to be edited as follows:
Function DeleteTwoCharWordsWithExceptions(oDoc As Document) As Boolean
Dim ExceptDic As Object
Dim exceptlist As Variant
Dim idx As Long
Dim rg As Range
On Error GoTo Err\_Handler
Set ExceptDic = CreateObject("Scripting.Dictionary")
exceptlist = Split("in|of|to|is|it|on|no|us|at|un|go|an|my|up|me|as|he|we|so|be|by|or|do|if|hi|bi|ex|ok", "|")
' load the dictionary with words from exceptlist
For idx = 0 To UBound(exceptlist) - 1
ExceptDic.Add exceptlist(idx), exceptlist(idx)
Next idx
Set rg = oDoc.Range
With rg.Find
.MatchWildcards = True
.Text = "<??>[ .,\?\)^13]"
.Format = False
.Forward = True
.Wrap = wdFindStop
While .Execute
If Not ExceptDic.Exists(Trim(rg.Text)) Then
rg.Text = ""
rg.Collapse wdCollapseEnd
DoEvents
End If
Wend
End With
DeleteTwoCharWordsWithExceptions = True
lbl_Exit:
Exit Function
Err_Handler:
DeleteTwoCharWordsWithExceptions = False
Resume lbl_Exit
End Function