Private Sub Command1_Click() CommonDialog1.FileName = "" CommonDialog1.Filter = "All Files|*.*" CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer CommonDialog1.Action = 1
Dim s As String s = CommonDialog1.FileName Dim arr arr = Split(s, Chr(0)) '不同的系统分割符可能不同,我这是在2000下 Dim path As String Dim file1 As String Dim i As Long i = InStrRev(arr(0), "\") List1.Clear If i > 0 Then path = Left(arr(0), i - 1) If UBound(arr) >= 1 Then For i = 1 To UBound(arr) List1.AddItem path + "\" + arr(i) Next Else List1.AddItem s End If End If End Sub
CommonDialog1.FileName = ""
CommonDialog1.Filter = "All Files|*.*"
CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer
CommonDialog1.Action = 1
Dim s As String
s = CommonDialog1.FileName
Dim arr
arr = Split(s, Chr(0)) '不同的系统分割符可能不同,我这是在2000下
Dim path As String
Dim file1 As String
Dim i As Long
i = InStrRev(arr(0), "\")
List1.Clear
If i > 0 Then
path = Left(arr(0), i - 1)
If UBound(arr) >= 1 Then
For i = 1 To UBound(arr)
List1.AddItem path + "\" + arr(i)
Next
Else
List1.AddItem s
End If
End If
End Sub