|
楼主 |
发表于 2016-1-5 21:18
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
原代码如下:
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
If fd.Show = -1 Then GetDirectory = fd.SelectedItems(1)
Dim c As Long, R As Long, i As Long
Dim FileName As Object, ObjShell As Object, ObiFolder As Object
Set ObjShell = CreateObject("shell.Application")
Set ObiFolder = ObjShell.Namespace(GetDirectory)
On Error Resume Next
c = 0
For i = 0 To 34
If i = 27 Or i = 28 Or i = 29 Or i = 31 Then
'
Else
c = c + 1
Cells(1, c) = ObiFolder.getdetailsof(ObiFolder.Items, i)
End If
Next i
R = 1
For Each FileName In ObiFolder.Items
c = 0
R = R + 1
For i = 0 To 34
If i = 27 Or i = 28 Or i = 29 Or i = 31 Then
'
Else
c = c + 1
Cells(R, c) = ObiFolder.getdetailsof(FileName, i)
End If
Next i
Next FileName
ActiveSheet.ListObjects.Add xlSrcRange, [A1].CurrentRegion
Set fd = Nothing |
|