第1个回答 推荐于2016-03-22
Dim Files() As String
Private Sub Command1_Click()
getFiles "c:\", Files() '获得文件,文件保存在Files()中
'后面为读取数据
End Sub
Private Sub getFiles(ByVal FilePath As String, F() As String)
Dim FileList As FileListBox
Dim i As Integer
Set FileList = Me.Controls.Add("VB.FileListBox", "FileList", Me)
FileList.Pattern = "*.txt"
FileList.Path = FilePath
For i = 0 To FileList.ListCount - 1
ReDim Preserve F(i)
F(i) = FilePath & FileList.List(i)
Next
Me.Controls.Remove FileList.Name
Set FileList = Nothing
End Sub本回答被提问者采纳