getopenfilename

How do you get just the filename rather than the entire file path of an open file?

孤人 提交于 2019-11-26 22:12:36
问题 In other words, would I need to do some string processing after invoking the Application.GetOpenFileName() Method? 回答1: I am using these functions for filename processing. The last one is the one you need here. Public Function FilePathOf(ByVal s As String) As String Dim pos As Integer pos = InStrRev(s, "\") If pos = 0 Then FilePathOf = "" Else FilePathOf = Left$(s, pos) End If End Function Public Function FileNameOf(ByVal s As String) As String Dim pos1 As Integer, pos2 As Integer pos1 =