G
Guest
Hi,
I want to write a For loop that will put file names of extensions (*.txt and
*.csv) in an array.
I had it work fine for one extension, and I need help making it work for two
extensions. My code is below:
Dim dir As New DirectoryInfo("C:\Test")
Dim fileNames(dir.GetFiles("*.txt").Length - 1)) As String
Dim myfile As FileInfo
For Each myfile In dir.GetFiles("*.txt")
fileNames(i) = myfile.FullName
i += 1
Next
I want to write a For loop that will put file names of extensions (*.txt and
*.csv) in an array.
I had it work fine for one extension, and I need help making it work for two
extensions. My code is below:
Dim dir As New DirectoryInfo("C:\Test")
Dim fileNames(dir.GetFiles("*.txt").Length - 1)) As String
Dim myfile As FileInfo
For Each myfile In dir.GetFiles("*.txt")
fileNames(i) = myfile.FullName
i += 1
Next