当前位置: 动力学知识库 > 问答 > 编程问答 >

excel vba - VBA: Use of Multiple Dir() functions (Local function)

问题描述:

how to use Dir() function in Dir() function loop?(local Dir())

I need to read directory, than read sub directory and take file.

Dim Path as String

Path = "D:/Path/"

Dim DH as String 'iterator for Dir()

DH = Dir(Path)

Do While DH<>""

IF (GetAttr(Path + DH) and vbDirectory) = vbDirectory Then 'directory? yes

ReadThisDirectory(Path + DH + "/")

End If

Loop

Sub ReadThisDirectory(dir_path as string)

Dim MyVar as String

MyVar = dir_path + Dir(dir_path)

End Sub

分享给朋友:
您可能感兴趣的文章:
随机阅读: