- ©«¤l
- 73
- ¥DÃD
- 11
- ºëµØ
- 0
- ¿n¤À
- 100
- ÂI¦W
- 0
- §@·~¨t²Î
- Win 8
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2013-5-11
- ³Ì«áµn¿ý
- 2018-7-25
|
¦^´_ 5# Hsieh
ª©¤j§Ú¦³¬Ý§¹§APOªº¤å¡ASub list_and_link1 ¥i¥H¦C¥X©Ò¦³ÀɮצW
----------------------------------------------------------------------------------------------------------
¥t¥~¤]§ä¤F¤@ºØ¤èªk¡A¥¦¥i¥HÀ°§Ú§ä¥X©Ò¦³ÀɮצWºÙ¡A¦ý¦³Ó¤p¤p°ÝÃD¡A
¦pªGSheet1ªºRange("A1") ¬O·j´MªºÀɦW¡A¨Ò¦p:file(¦p¥DÃD¤¤ªºªþ¥ó)¡A¦p¦ó¦b·j´M¨ì«á¥´¶}¥L???·PÁ±z^^
Public Sub TestListDir()
Worksheets(1).Cells(2, 1).Activate
Call listDir("C:\Users\ui\Desktop\New folder\", 1)
End Sub
Public Sub listDir(strPath As String, lngSheet As Long)
Dim strFn As String
Dim strDirList() As String
Dim lngArrayMax, x As Long
lngArrayMax = 0
strFn = Dir(strPath & "*.*", 23)
While strFn <> ""
If strFn <> "." And strFn <> ".." Then
If (GetAttr(strPath & strFn) And vbDirectory) = vbDirectory Then
lngArrayMax = lngArrayMax + 1
ReDim Preserve strDirList(lngArrayMax)
strDirList(lngArrayMax) = strPath & strFn & "\"
Else
ActiveCell.Value = strPath & strFn
Worksheets(lngSheet).Cells(ActiveCell.Row + 1, 1).Activate
End If
End If
strFn = Dir()
Wend
If lngArrayMax <> 0 Then
For x = 1 To lngArrayMax
Call listDir(strDirList(x), lngSheet)
Next
End If
End Sub |
|