View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
K[_2_] K[_2_] is offline
external usenet poster
 
Posts: 557
Default Extract Name from File Path

Hi all, in cell A1 i have file path as below

C:\Documents and Settings\My Documents\Tests\Test1\Simon Brown.txt

and i got macro on a button (see below)

Sub Button1_Click()
cv = Range("a1").Value
Range("a3").Value = Right(cv, Len(cv) - InStrRev(cv, "\"))
End Sub

I get result "Simon Brown.txt" in cell A3 but i just need result
"Simon Brown". So please can anyone help that what changes i should
do in my macro above which should get rid of any thing after dot
like .txt and just give the person name like "Simon Brown"