티스토리 뷰
아래 코드를 사용할 수 있습니다. @ Frédéric Hamidi 출처 : 질문 :
Dir ()는 반환 된 파일의 순서를 보장합니까?
Dim allFiles As Variant
allFiles = GetFileList(MyDir & "wp*.xls")
If IsArray(allFiles) Then
Call QuickSort(allFiles, LBound(allFiles), UBound(allFiles))
End If
Dim x As Integer
Dim lstFile As String
x = 1
' still need to loop through results to get lastFile
While lstFile <> LastFileName
lstFile = allFiles(x)
x = x + 1
Wend
For i = x To UBound(allFiles)
MyFileName = allFiles(i)
Cells(LastRow + 1, 1) = MyFileName
LastRow = LastRow + 1
Next i
출처
https://stackoverflow.com/questions/39917328
댓글