splitting a file path

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there an easy way to split a full path name into two parts, one being the
path and the other being the file name w/o counting from the right to find
the last backslash. I am getting the full path from the FileDialog object.
Thanks.
 
Dir(FullPath) will return the file name

Left(FullPath,Len(FullPath)-Len(Dir(FullPath))) should return just the
directory without the file name
 
Dir(FullPath) will return the file name

Left(FullPath,Len(FullPath)-Len(Dir(FullPath))) should return just the
directory without the file name

....but only if the drive letter is accessible, the user has the
necessary permissions and the file exists. IMHO it's safer to use (in
recent versions of Access) something like

FileName = Mid(FullPath, InstrRev(FullPath, "\") + 1)
Folder = Left(FullPath, InstrRev(FullPath, "\") - 1)
 
That worked great thanks.

John Spencer said:
Dir(FullPath) will return the file name

Left(FullPath,Len(FullPath)-Len(Dir(FullPath))) should return just the
directory without the file name
 
Back
Top