(Solved) – How to show directories in vba’s immediate window?


I want to list all directories in c: disk in vba’s immediate window,write the below code in immediate window:

Dim FileName As String
FileName = Dir("C:", vbDirectory)

Do While FileName <> ""
    Debug.Print FileName
    FileName = Dir()

Now to click enter,

enter image description here

How to fix my vba code to show all directories in c: in vba’s immediate window?

Leave a Reply

Your email address will not be published. Required fields are marked *