A family of Microsoft word processing software products for creating web, email, and print documents.
At the end of the routine, the array is empty.
Can anyone explain why?
Because ReDim arrNumerals(c) clears the array. Try:
Sub MyCode()
Dim c As Long, arrNumerals() As Variant
With ActiveDocument.Content
With .Find
.ClearFormatting
.Text = "[0-9]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
End With
While .Find.Execute
c = c + 1
ReDim Preserve arrNumerals(c)
arrNumerals(c) = .Text
Wend
End With
MsgBox "Total numbers found = " & c & ":" & vbCr & Join(arrNumerals, ",")
End Sub