一. 单层文件夹
Sub GetFiles()
Dim strPath As String, strFileName As String, k As Long
' 用户选择文件夹路径
With Application.FileDialog(msoFileDialogFolderPicker)
' 如果用户未选择文件夹则退出程序
If .Show Then
strPath = .SelectedItems(1)
Else
Exit Sub
End If
End With
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
Application.ScreenUpdating = False '取消屏幕刷新
' 清除当前工作表A列数据
Columns(1).Clear: Cells(1, 1) = "目录"