可惜还有点偏差,我的目标是要把获取到的名称插入表中的字段“文件名”中,下面二段语句子怎改?
Private Sub cmd_OK_Click()
On Error Resume Next
With FileDialog(msoFileDialogFolderPicker)
.Filters.Clear
If .Show Then
Me.filepath = .SelectedItems(1)
End If
End With
Me.List1.RowSource = ""
Me.List2.RowSource = ""
Me.List3.RowSource = ""
Call ShowFolderList(Me.filepath)
Call ShowFileList(Me.filepath)
Call SoSuoFile(Me.filepath)
End Sub
Private Sub ShowFileList(FolderSpec As String)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(FolderSpec)
Set fc = f.Files
For Each f1 In fc
Me.List2.AddItem f1.Name
' Call ShowFileList(folderspec & "\" & f1.Name)
Next
End Sub
单击下载