Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File Scripting object
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00453480
Message ID:
00453509
Views:
47
>>>I'm tring to convert this code from vbs to vfp. It simply list a list of files in a certain directory. I get the following error "'Files' is not a varible".
>>>
>>>
>>>Here is the code:
>>>
>>>fso = CreateObject("Scripting.FileSystemObject")
>>>f = fso.GetFolder("c:\test")
>>>fc = f.Files
>>>For Each f1 in fc
>>> s = s + f1.name
>>> s = s + "< BR >"
>>>Next
>>>? s
>>
>>It's something with that f or f1 variable. The following works fine on my machine
lcfolder = GETDIR()
>>oFSO = CREATEOBJECT('Scripting.FileSystemObject')
>>oFolder = oFSO.GetFolder(lcfolder)
>>FOR EACH oFile IN oFolder.Files
>>    ? oFile.Name
>>NEXT
However, when I used your code, I got the same result until I changed that variable.
>
>You're not alone -- I hit exactly that same thing last month while trying to explain the FSO to a customer. Hmm, wonder how to submit an ER on that... <*wanders off, mumbling*>

Now that you mention it, Garrett, I seem to recall something similar to this before myself. I do trust Sarek to find a way to sumbit that ER, however.:-)
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform