Skip to main content

Posts

Showing posts with the label Get Sub Directories using VBA FileSystemObject Function

How to iterate through all Subdirectories till the last directory in VBA

List all Level SubDirectories using VBA The following code lists all the directories under c:\Temp Function GetSubDir(ByVal sDir) Dim oFS As New FileSystemObject Dim oDir Set oDir = oFS.GetFolder(sDir) For Each oSub In oDir.SubFolders MsgBox oSub.Path GetSubDir oSub.Path Next oSub End Function You can call the function like shown below GetSubDir "C:\Temp\" The code uses FileSystemObject from Microsoft Scripting RunTime. You need to add reference to this library (see figure below) See also VBA Dir Function to Get Sub Directories

Facebook

Facebook Recommendations

Followers


Web Designing In Karachi



Haroof.com


Politics blogs

My Zimbio

Email Subscribe

Enter your email address:

Watch online Live TV

Labels

Show more