View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Valid File Path Format

Todd,

I don't think there is a (built in) way to check just the syntax
of a file name. Since, I assume, you are going to use the value
to open or save a file, just go ahead and do the operation and
use an error trap to determine the success of the operation. An
alternative would be to use the Dir() function, and test for an
error.

Dim FNum As Integer
Dim FName As String
On Error GoTo ErrH:
FName = "invalid/::???file\\\??name"
FNum = FreeFile()
If Dir(FName) = "" Then
' do nothing
End If
Exit Sub
ErrH:
If Err.Number = 52 Then
MsgBox "Invalid filename "
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Todd Huttenstine" wrote in
message ...
Good morning

How do you check a value to see if it is in a valid file
path format?


Thank you
Todd Huttenstine