Re: Extracting filename from path



Charles,

Dir("D:\documents\file1.txt",vbNormal)

or

Dim sFile As String
sFile = "D:\documents\file1.txt"
Right(sFile, len(sfile)-InstrRev(sfile, "\",-1))

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Charles Tam" <CharlesTam@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:273BB134-0345-42AC-B780-573E631B6811@xxxxxxxxxxxxxxxx
> Given a directory path string, such as "D:\documents\file1.txt", how do I
> extract the filename part?
>
>


.



Relevant Pages

  • Extracting filename from path
    ... Given a directory path string, such as "D:\documents\file1.txt", how do I ... extract the filename part? ... Prev by Date: ...
    (microsoft.public.access.formscoding)
  • Re: Extract filename from path
    ... pop is Mark ... > How can I extract only the filename from the FILENAME variable, ... Prev by Date: ...
    (comp.lang.awk)
  • Re: Extract filename from path
    ... Jeroen Gouma wrote: ... > How can I extract only the filename from the FILENAME variable, ... Prev by Date: ...
    (comp.lang.awk)
  • Extract filename from path
    ... How can I extract only the filename from the FILENAME variable, ... But how to find the last \ if the lenght of the ... Prev by Date: ...
    (comp.lang.awk)
  • Re: OpenFileDialog and passing a relative directory automaticly to it
    ... i have a circumstance where a user unzips a file, with a certain layer ... in most cases i can be sure the zip fie will extract as shown, ... If you know the actual filename, _and_ you know that filename is unique within the subdirectories that have been extracted, then you could do a search of that subtree of the file system to find the file. ... Just because the files can be extracted anywhere, that doesn't preclude using absolute paths. ...
    (microsoft.public.dotnet.languages.csharp)