|
文件目录链接(07版可用)
本帖最后由 shijianchang 于 2011-10-10 11:16 编辑
修改为07版,代码如下,
Sub wjlj() '适用于07版
Dim fso As Object
Dim objFile, objFolder
Dim i As Integer
Range("A2:F65536").ClearContents
Set fso = CreateObject("Scripting.FileSystemObject")
Application.DisplayAlerts = False
' On Error Resume Next
Folder = Directory
Application.ScreenUpdating = False
Set objFolder = fso.getFolder(Folder)
i = 1
For Each objFile In objFolder.Files '文件名Files,文件夹SubFolders
i = i + 1
Cells(i, 1) = Folder
Cells(i, 2) = objFile.Name
Cells(i, 3) = objFile.Type
Cells(i, 4) = objFile.Size
Cells(i, 5) = objFile.DateLastModified
ActiveSheet.Hyperlinks.Add Anchor:=Cells(i, 2), Address:=Folder & objFile.Name
Next
End Sub |
|