-
'I want to list the file names but not
'sure how to call them
myFolder = "a:\image viewer\images"
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO = FSO.GetFolder(myFolder)
iLen = FSO.Files.Count
ReDim iArray(iLen)
For iCount = 1 To iLen
iArray(iCount) = 'how do I get the file name here
List1.AddItem iArray(iCount)
Next
-
try something like this instead;
Code:
Set objFilesys = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFilesys.GetFolder(strFolderPath)
Set collFiles = objFolder.Files
For Each objFile in collFiles
'..do whatever you want with the file name
'..i.e store to an array
Next
good luck
/d8/
-
..the best...
works like a charm...all I wanted to do
was to uppercase all the filenames in a
given folder and your way beats the crap
out of my idea...
thanks...
-
Or altreantivley, if you do not want to have to include the scripting runtime libraries with your project.
Code:
Dim stFile as String
stFile = Dir$("c:\path\*.*")
Do While stFile <> ""
List1.Additem stFile
stFile = Dir
Loop
-
-
scripting
Yup...I use it for two or three other functions in the app so I have to load it...
will keep the (without fso code)..add it to my database for future reference..
thanks