如题所述
åç»ä½ åèä¸ä¸,ç½ä¸æç
Sub getpath()
Range("A2:D1000").ClearContents
On Error Resume Next
Dim shell As Variant
Set shell = CreateObject("Shell.Application")
Set filePath = shell.BrowseForFolder(&O0, "éæ©æ件夹", &H1 + &H10, "") 'è·åæ件夹路å¾å°å
Set shell = Nothing
If filePath Is Nothing Then
Exit Sub
Else
gg = filePath.Items.Item.Path
End If
Set obj = CreateObject("Scripting.FileSystemObject")
Set fld = obj.getfolder(gg)
For Each ff In fld.Files
m = m + 1
Cells(m + 1, 1) = ff.name
Cells(m + 1, 2) = ff.Path
Cells(m + 1, 3) = ff.Size
Cells(m + 1, 4) = ff.DateCreated
Next
End Sub
Sub getpath()
Range("A2:D1000").ClearContents
On Error Resume Next
Dim shell As Variant
Set shell = CreateObject("Shell.Application")
Set filePath = shell.BrowseForFolder(&O0, "éæ©æ件夹", &H1 + &H10, "") 'è·åæ件夹路å¾å°å
Set shell = Nothing
If filePath Is Nothing Then
Exit Sub
Else
gg = filePath.Items.Item.Path
End If
Set obj = CreateObject("Scripting.FileSystemObject")
Set fld = obj.getfolder(gg)
For Each ff In fld.Files
m = m + 1
Cells(m + 1, 1) = ff.name
Cells(m + 1, 2) = ff.Path
Cells(m + 1, 3) = ff.Size
Cells(m + 1, 4) = ff.DateCreated
Next
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答 2012-05-31
工作薄路径 ActiveWorkbook.Path
工作薄名称 ActiveWorkbook.Name
工作薄名称 ActiveWorkbook.Name
第2个回答 2012-05-31
ThisWokrBook.path 和 name