Sub Macro4()    
MsgBox FileNameNoExt("\\Corpapps\Users\prasada\My Documents\Balance Sheet\FY 11\10-11\Trial Balance 10-11.xls")
End Sub

'The following function returns the filename without the extension from the file's full path:
Function FileNameNoExt(strPath As String) As String
    Dim strTemp As String
    strTemp = Mid$(strPath, InStrRev(strPath, "\") + 1)
    FileNameNoExt = Left$(strTemp, InStrRev(strTemp, ".") - 1)
End Function

 'The following function returns the filename with the extension from the file's full path:
Function FileNameWithExt(strPath As String) As String
    FileNameWithExt = Mid$(strPath, InStrRev(strPath, "\") + 1)
End Function

 'The following function will get the path only (i.e. the folder) from the file's ful path:
Function FilePath(strPath As String) As String
    FilePath = Left$(strPath, InStrRev(strPath, "\"))
End Function

'To get file extension from any string
sfile = "Ajeet.xls"
MsgBox Right$(sfile, Len(sfile) - InStrRev(sfile, "."))