Hi This code works great unless there is a comma in the filename:
If a comma exists the file is added to the list, but stops at the first comma.
Example:
Test File 1.xml works fine.
Test, File 1.xml only add "File" to the list.
What am I missing?
Thanks,
John
Code:
Dim dir, folder, files
dir = "c:\ValidateFiles\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(dir)
Set files = folder.files
lstFiles.RowSourceType = "Value List"
For Each file In files
If Right(file.Name, 3) = "xml" Or Right(file.Name, 3) = "XML" Then
lstFiles.AddItem (file.Name)
End If
Next
Example:
Test File 1.xml works fine.
Test, File 1.xml only add "File" to the list.
What am I missing?
Thanks,
John
Comment