Don't bother with writing a parser for file names -- that already exists in
Windows. Just include an On Error statement that will redirect the macro's
execution to an error handler if the name is invalid.
Dim MyFileName As String
MyFileName = "X:\bad path\possibly invalid filename.doc"
On Error GoTo BadFileName
Documents.Open(MyFileName)
' rest of the macro...
Exit Sub
BadFileName:
MsgBox MyFileName & " is not valid"
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.