如何在  f:\abc\dfd\d\fd\sa\dsa\dfd\das.txt
中提出来das.txt
f:\abc\dfd\d\fd\sa\dsa\dfd\ 是不固定的。

解决方案 »

  1.   

    dim FullPath ="f:\abc\dfd\d\fd\sa\dsa\dfd\das.txt"
    FileName=Right(FullPath, Len(FullPath) - InStrRev(FullPath, "\"))
    pathStr=Left(FullPath, InStrRev(FullPath, "\"))
      

  2.   

    dim fullPath as string,fileName as string,strResult as string
    fuulPath="f:\abc\dfd\d\fd\sa\dsa\dfd\das.txt"
    fileName="das.txt"
    strResult=left(fullPath,instr(fullPath,filName))
      

  3.   

    Dim FullPath,FileName As String
    FullPath ="f:\abc\dfd\d\fd\sa\dsa\dfd\das.txt"
    FileName=Right(FullPath, Len(FullPath) - InStrRev(FullPath, "\"))
      

  4.   

    Dim strPath         As String
        Dim strName         As String
        
        strPath = "f:\abc\dfd\d\fd\sa\dsa\dfd\das.txt"
        strName = Mid$(strPath, InStrRev(strPath, "\") + 1)
      

  5.   

    这个问题以前回答过,其实不难的,可以利用VB里的SPLIT函数来分隔"\"符号。一个获得文件后缀名的子程序,参数可以是一个包含路径的任意文件名:  
    Function  GetLastName(FileName  as  string)  as  String  
    Dim  Names  
    Names  =  Split(FileName  ,  ".",  -1)  
    GetLastName  =  Names(UBound(Names))  
    End  Function 一个获得文件名的子程序,参数可以是一个包含路径的任意文件名:  
    Function  GetLastName(FileName  as  string)  as  String  
    Dim  Names  
    Names  =  Split(FileName  ,  "\",  -1)  
    GetLastName  =  Names(UBound(Names))  
    End  Function  原贴见:http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=197894
      

  6.   

    x="f:\abc\dfd\d\fd\sa\dsa\dfd\das.txt"
    filename=mid(x,instrrev(x,"\")+1)
    print filename