I'm with smUX.
Besides this when you want to check whether a file name is in particular format or not then use the LIKE keyword.
VB Code:
  1. m = Dir("C:\Test\*.*")
  2. If Not UCase(m) Like "A##.DOC" Then    'filters out files like A001.doc, A56.doc etc.
  3.     'invalid file name. etc.
  4.     MsgBox "Invalid file name" & m
  5. Else
  6.     'whatever
  7. End If

Pradeep