Loop Through All Subfolders Using VBA [duplicate]

Just a simple folder drill down. sub sample() Dim FileSystem As Object Dim HostFolder As String HostFolder = “C:\” Set FileSystem = CreateObject(“Scripting.FileSystemObject”) DoFolder FileSystem.GetFolder(HostFolder) end sub Sub DoFolder(Folder) Dim SubFolder For Each SubFolder In Folder.SubFolders DoFolder SubFolder Next Dim File For Each File In Folder.Files ‘ Operate on each file Next End Sub

How do I use FileSystemObject in VBA?

Within Excel you need to set a reference to the VBScript run-time library. The relevant file is usually located at \Windows\System32\scrrun.dll To reference this file, load the Visual Basic Editor (ALT+F11) Select Tools > References from the drop-down menu A listbox of available references will be displayed Tick the check-box next to ‘Microsoft Scripting Runtime‘ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)