View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
dd dd is offline
external usenet poster
 
Posts: 95
Default Request advice on Split(sFile, "\")

Nick

I wonder if you can help me with the data in Column C

With the following snippet of code, I want the ..iPathColC).Value to equal
the path string between PathParts(8) and the filename:

That is, for the path:
P:\GB123\Rail\Jobs\Feb06\Surveys\Trial surveys\Kyle of
Lochalsh\Station\Proforma\Part01\Station 01.pfm, I want to extract \Proforma
and any other directories before the filename into the ... iPAthColC).Value


sFile = oFile.Path

PathParts = Split(sFile, "\")

Cells(iFile, iPathColA).Value = PathParts(6) & "\"
Cells(iFile, iPathColB).Value = PathParts(7) & "\"

Temp = Mid(sFile, Len(PathParts(6)) + Len(PathParts(7)))
Cells(iFile, iPathColC).Value = Left(Temp, Len(Temp) -
Len(PathParts(UBound(PathParts))))

Cells(iFile, iFileCol) = oFile.Name

Regards
D Dawson