View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Extracting filename

Use the instrRev function to get the last \

sFile = "C:\mydocumentspath\subpath\myfile.xls"

iPos = InStrRev(sFile, "\")
If iPos 0 Then
Debug.Print Right(sFile, Len(sFile) - iPos)
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
Hi All
In a file open dialog I get the full file path and filename and extension.
eg



What is the best method to extract the filename extension only eg

myfile.xls

--
Cheers
Nigel