Vba – Import file name into list box without path access 2007 vba-

ms-accessvba

I am creating a database where users can click a command button, they will be taken to a folder that is stored in a trusted location and they can choose a word document from there and all the names of chosen files will show in a list box on a form. We have the code to double click the file name to open the document. What we are looking for is code to show only the file name in the list box without the path.

We have used the sample code given in the question "How to show open file dialogue in access 2007 vba" from this site to set this up so far.

Any help would be great.

Best Solution

Execute the following code for each file name to be inserted into the list box.

Dim Chunks() As String, DocumentName As String
Chunks() = Split("\\server\share\folder\subfolder\docuemnt.doc", "\")
DocumentName = Chunks(UBound(Chunks()))
Related Question