티스토리 뷰
Excel VBA 지정한 폴더 안에있는 파일명 출력하는 예제
Sub Main()
dirName = "c:\practice\"
Call printFileList(dirName)
End Sub
Sub printFileList(folderName)
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder(folderName)
i = 1
'loops through each file in the directory and prints their names and path
For Each objFile In objFolder.Files
'print file name
Cells(i + 1, 1) = objFile.Name
'print file path
Cells(i + 1, 2) = objFile.Path
i = i + 1
Next objFile
End Sub
이렇게 출력된다.
end.
728x90
'Excel VBA > VBA 예제' 카테고리의 다른 글
file을 열지 않고 값 가져오기 (6) | 2016.06.11 |
---|---|
Excel Vba Array, List, Map은 Collection으로 쓰는게 좋을 것 같다 (0) | 2016.04.30 |
VBA Sheet의 행 개수, 열 개수 구하기 (5) | 2016.04.17 |
vba 숫자를 영문자로 바꾸기 (2) | 2016.04.17 |
알파벳 aa to az까지 만들기 ExcelVBA, Java (0) | 2015.12.22 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 2017 티스토리 결산
- Sh
- 도커각티슈케이스
- 도커티슈박스
- shellscript
- docker container
- docker container tissue
- 도커각티슈박스
- 도커티슈케이스
- 도커컨테이너
- 싱가폴
- vim
- Linux
- docker container tissue box
- 개발자
- docker container case
- docker container whale
- 이직
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함