Perhaps a bit of filtering should be used.

Insert:
If Left(Split(f1.Name, ".")(1), 3) = "doc" Then
before:
n = 0
and insert:
End If
before:
Next

Note: the above won't work properly with files that have periods in the filename, but you really shouldn't have such files anyway.