this is not my script and i have not tested this modification, but try like
ReDim badAddresses(1 to 1) As String
' initialize variant position counter
i = 1
' parse each message in the folder holding the bounced emails
For Each Item In olFolder.Items
  
   strBody = olFolder.Items(i).Body
   Set olMatches = regEx.Execute(strBody)
   If olMatches.Count >= 1 Then
    redim preserve badaddresses(1 to ubound(badaddresses) + olmatches.count - 1)    ' check this gives correct result
    for m = 0 to olmatches.count -1
       badAddresses(i) = olMatches(m)
       i = i + 1
       Item.UnRead = False
    next
   End If
Next Item