Function Inverter(nb As String) As String Dim bn As String
For i = 1 To Len(nb)
bn = Mid(nb, i, 1) & bn
Next i
Inverter = bn
End Function
Sub invert()
Dim a As Long
Selection.GoTo What = wdGoToLine, Which = wdGoToFirst
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([!0-9])([0-9]@)([!0-9])"
'.Replacement.Text = "\1" & a="\2" inverter(a) & "\3"
.Forward = True
'.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
'.Execute Replace:=wdReplaceOne
While .Execute
Selection.Text = Inverter(Selection.Text)
Wend
End With
Selection.GoTo What = wdGoToLine, Which = wdGoToFirst
End Sub
Sub ZarCleaner()
With Selection.Find
.Text = "\<Page*[0-9]@*\>": .Replacement.Text = "^m": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = True: .MatchSoundsLike = False: .MatchAllWordForms = False: .Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "[\>-\<]\/F\<\>F*St\=’[A-Z]’[\>-\<]": .Replacement.Text = " ": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = True: .MatchSoundsLike = False: .MatchAllWordForms = False: .Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "[\>-\<]F*St\=’[A-Z]’[\>-\<]": .Replacement.Text = " ": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = True: .MatchSoundsLike = False: .MatchAllWordForms = False: .Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "([\>-\<]Image \= )(*)( [\>-\<])": .Replacement.Text = " ": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = True: .MatchSoundsLike = False: .MatchAllWordForms = False: .Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "<k[ ]?*[ ][0-9]>": .Replacement.Text = " ": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = True: .MatchSoundsLike = False: .MatchAllWordForms = False: .Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "([\>-\<]align*['left'-'right'-'Center'][\>-\<])(*)([\>-\<]\/align[\>-\<])": .Replacement.Text = "\2": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = True: .MatchSoundsLike = False: .MatchAllWordForms = False: .Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "[\>-\<]align*['left'-'right'-'Center'][\>-\<]": .Replacement.Text = " ": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = True: .MatchSoundsLike = False: .MatchAllWordForms = False: .Execute Replace:=wdReplaceAll
End With
With Selection.Find
.Text = "[\>-\<]\/align[\>-\<]": .Replacement.Text = " ": .Forward = True: .Wrap = wdFindContinue: .Format = False: .MatchCase = False: .MatchWholeWord = False: .MatchKashida = False: .MatchDiacritics = False: .MatchAlefHamza = False: .MatchControl = False: .MatchWildcards = True: .MatchSoundsLike = False: .MatchAllWordForms = False: .Execute Replace:=wdReplaceAll
End With
Call invert
End Sub