로그인 유지
이 게시판은 아별닷컴 회원만 질문을 올릴 수 있습니다. 회원에게 주어지는 특권인셈이지요. 회원이 아닌 분들은 열람만 가능합니다.
2019.06.05 21:55
오랫만에 다시 보는 코드 ㅎㅎ
겸사 겸사.. 특정 경로의 폴더를 순차적으로 만들어주는 코드를 정리해봤습니다.
Sub abMakeFolderPath()
'### Created by abyul.com 2012.08.16
Dim strPath As String: strPath = "C:\Secret\Hot\Cool\"
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
Dim i As Integer, intPosition As Integer: intPosition = 4
For i = 1 To UBound(Split(strPath, "\")) - 1
If Dir(Left(strPath, InStr(intPosition, strPath, "\")), vbDirectory) = Empty Then
MkDir Left(strPath, InStr(intPosition, strPath, "\"))
End If
intPosition = InStr(intPosition, strPath, "\") + 1
Next i
End Sub
새 창으로
선택한 기호
오랫만에 다시 보는 코드 ㅎㅎ
겸사 겸사.. 특정 경로의 폴더를 순차적으로 만들어주는 코드를 정리해봤습니다.
Sub abMakeFolderPath()
'### Created by abyul.com 2012.08.16
Dim strPath As String: strPath = "C:\Secret\Hot\Cool\"
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
Dim i As Integer, intPosition As Integer: intPosition = 4
For i = 1 To UBound(Split(strPath, "\")) - 1
If Dir(Left(strPath, InStr(intPosition, strPath, "\")), vbDirectory) = Empty Then
MkDir Left(strPath, InStr(intPosition, strPath, "\"))
End If
intPosition = InStr(intPosition, strPath, "\") + 1
Next i
End Sub