Hi,
Trying to run this code
Code:
Sub FindTemplate()
Dim aRng As Range, str As String, int1 As Integer, int2 As Integer, arrStr() As String
Set aRng = ActiveDocument.Range
With aRng.Find
.ClearFormatting
.MatchWildcards = True
.Text = " [0-9]{2,3}"
Do While .Execute = True
arrStr = Split(aRng.Text, " ")
int1 = CInt(arrStr(0)) + 2
aRng.Text = " " & int1
aRng.Collapse Direction:=wdCollapseEnd
aRng.End = ActiveDocument.Range.End
Loop
End With
End Sub
but it's throwing a a Type mismatch error 13 on
Code:
int1 = CInt(arrStr(0)) + 2
Why is that? What am I doing wrong?