Private Sub Command1_Click()
On Error GoTo userCanceled
Dim i As Integer
With CommonDialog1
.CancelError = True
.Flags = cdlOFNHideReadOnly Or cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNNoDereferenceLinks
.Filter = "所有文件(*.*)|*.*"
.ShowOpen
GetFileInfo (.FileName)
End With
List1.Clear
For i = 1 To UBound(FileInfo)
List1.AddItem FileInfo(i)
Next
Label3 = FileInfo(0)
userCanceled:
End Sub
Private Sub GetFileInfo(Source As String)
Dim t As Integer
FileInfo = Split(Source, Chr(0))
If UBound(FileInfo) = 0 Then
ReDim Preserve FileInfo(1)
t = InStrRev(FileInfo(0), "\")
FileInfo(1) = Mid(FileInfo(0), t + 1)
FileInfo(0) = Left(FileInfo(0), t)
Else
If Right(FileInfo(0), 1) <> "\" Then FileInfo(0) = FileInfo(0) & "\"
End If
End Sub
文章来源于领测软件测试网 https://www.ltesting.net/
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073