'提取文件的名称
Public Function FileName(file As String) As String
    Dim i As Integer
    Dim File_Str() As String
    File_Str() = Split(file, "\")
    i = UBound(File_Str)
    FileName = File_Str(i)
End Function

解决方案 »

  1.   

    Public Function GetFilePath(filename As String)
        Dim x As String
        Dim position As Integer
        Dim y As Integer
        Dim myPath As String
        'If InStr(1, filename, ".htm", vbTextCompare) = 0 Then GoTo ll    x = filename
        For y = Len(x) To 1 Step -1
            If Mid(x, y, 1) = "/" Then
                position = y - 1
                Exit For
            End If
        Next ymyPath = Left(x, position)GetFilePath = Format(myPath)
    Exit Function
    LL:
    GetFilePath = filename
    End Function
      

  2.   

    Dim aa As String
    Dim i As Integer
    aa = "C:\Documents and Settings\Administrator\桌面\weboffice\1.wav"
    i = InStr(1, aa, "\")
    Do While i <> 0
    aa = Right(aa, Len(aa) - i)
    i = InStr(1, aa, "\")
    Loop有點麻煩
      

  3.   

    Public Function FileName(file As String) As String  FileName=ucase(right(file,len(file)-instrrev(file,"\")))
     
    end function没试过您自己试试吧!!!!!!