Selecting a File with the full path.

  • Thread starter Thread starter Crazyhorse
  • Start date Start date
C

Crazyhorse

I have to import 480 files into this database a year. Each File has a
different name.
This is the Path P:\MTAG5\Gigs\CustomizedReport\Reports\2007\01
07\"File_name".xls

How do I just tell access that I only want whats after the 7th "\" Up to the
..XLS that is want I want to select. VBA code is fine but I was trying to use
Mid but it does not work.

Thanks
 
Since P:\MTAG5\Gigs\CustomizedReport\Reports\2007\01 07\ is 50 characters,
Mid(FullPath, 51) will give you file_name.xls.

To eliminate the .xls, you'd use

Left(Mid(FullPath, 51), Len(Mid(FullPath, 51) - 4)
 
i have 200 and some excel files i want to link to a click button which will
open up a file based upon a control field say a name or number. Suggestions?
Code?
 
Another alternative is

Left(Mid(FullPath, InStrRev(FullPath, "\") + 1), Len(Mid(FullPath,
InStrRev(FullPath, "\") + 1) - 4)

As well, if the files actually exist, you can use Dir(FullPath) to return
file_name.xls, so that reduces to


Left(Dir(FullPath), Len(Dir(FullPath) - 4)

Unfortunately, using that means that you can't use the Dir function for
anything else at the same time in your code.
 
Back
Top