VB如何读取文件名如 : Test.txt  取得文件名 Test

解决方案 »

  1.   

    FullName="Test.abc.txt"
    FileName=Left(FullName,InStrRev(FullName,".")-1)
    Debug.Print FileName
      

  2.   

    FullName="Text.abc.txt"
    FileName=Left(FullName,InStrRev(FullName,".")-1)
    Debug.Print FileName
      

  3.   

    Dim Ctrl AS Control,CtrlName as string    For Each Ctrl In Me.Controls
            If TypeOf Ctrl Is Text Then
                CtrlName = Ctrl.Name
            End If
        Next Ctrl
      

  4.   

    dim arr () as string 
    const FullName="Text.abc.txt"arr=split(fullname,".")
    msgbox arr(0)