|
* 답변하시는 분들께 도움이 되도록 자신의 환경을 아래 항목 옆에 기재해 주세요.
- 엑셀 버전(,2007):
* 아래줄에 질문을 작성하세요 >>
아래 재귀 함수가 조건에 맞으면 종료 하고 싶어요
exit sub 도 안되고
exit loop도 안됨니다
방법이 없나요?
Sub LoopFile(strFilter, folderPath) 'Optional strFilter As String
Dim Filename As String, dirName As String
Dim fullFilePath As String
Dim numFolders As Long
Dim folders() As String
'Dim strFilter As String
Dim i As Long
'On Error Resume Next
If Right(folderPath, 1) <> "\" Then folderPath = folderPath & "\"
'strFilter = "*.*"
Filename = Dir(folderPath & strFilter)
Debug.Print folderPath
dirName = Dir(folderPath, vbDirectory)
Do While dirName <> ""
If Left(dirName, 1) <> "." Then
If (GetAttr(folderPath & dirName) And vbDirectory) = vbDirectory Then
ReDim Preserve folders(0 To numFolders) As String
folders(numFolders) = folderPath & dirName
numFolders = numFolders + 1
Else
If InStr(dirName, strFilter) >= 1 Then
여기서 조건에 맞으니 전프로그램 종요 하고 싶어요
End If
End If
End If
dirName = Dir()
Loop
For i = 0 To numFolders - 1
LoopFile strFilter, folders(i)
Next i
End Sub
|
|