
check string as valid filename
If InStr(1, strFile, "*") Or _
InStr(1, strFile, "/") Or _
InStr(1, strFile, "?") Or _
InStr(1, strFile, ":") Or _
InStr(1, strFile, "|") Or _
InStr(1, strFile, "<") Or _
InStr(1, strFile, ">") Then
'filename is not valid
Else
'filename should be valid
End If
that's the way i'd do it (and it's perhaps also the worst way of doing it).
Quote:
> > Hi,
> > FileSystemObject form Microsoft Scripting Runtime has FileExists metod.
> > --
> > HTH,
> > Alexander Shirshov, MCSD
> > > Hi!
> > > How can i check whether a string is a valid filename? Is
> > > there an api function call perhaps to check a string like
> > > "file/notvalid.txt"? (the slash is not valid!)
> > > Regards,
> > > Heiko
> Sorry, i didn't express it correct :
> There's no need that the file is an existing one, my question was
> whether the string contains a valid filename not an existing filename.
> I've found that one:
> http://support.microsoft.com/support/kb/articles/Q177/5/06.ASP
> Thanks,
> Heiko