此函數從字符串中分離出路徑
Function ParsePath (sPathIn As String) As String
Dim I As Integer
For I = Len(sPathIn) To 1 Step -1
If InStr(":\", Mid$(sPathIn, I, 1)) Then Exit For
Next
ParsePath = Left$(sPathIn, I)
End Function
此函數從字符串中分離出文件名
Function ParseFileName (sFileIn As String) As String
Dim I As Integer
For I = Len(sFileIn) To 1 Step -1
If InStr("\", Mid$(sFileIn, I, 1)) Then Exit For
Next
ParseFileName = Mid$(sFileIn, I + 1, Len(sFileIn) - I)
End Function
此函數從字符串中分離出文件擴展名
Function GetFileExt (sFileName As String) As String
Dim P As Integer
For P = Len(sFileName) To 1 Step -1
If InStr(".", Mid$(sFileName, P, 1)) Then Exit For
Next
GetFileExt = Right$(sFileName, Len(sFileName) - P)
End Function