This SHOULD be simple, but I can't figure out why I'm getting an error.
I've got a simple piece of VBScript code on an ASP page to tell me the number of files in a folder. I get the following error:
Microsoft VBScript runtime error '800a01a8'
Object required: '[number: 1]'
The "number:" part of the error message always reflects the correct result (i.e. 'number: 3' if there are 3 files in the folder).
What am I missing? I haven't used the Count property before, but I've seen examples of code that use it and I don't see what I'm doing wrong!
Here is the code, with the offending line highlighted:
I've got a simple piece of VBScript code on an ASP page to tell me the number of files in a folder. I get the following error:
Microsoft VBScript runtime error '800a01a8'
Object required: '[number: 1]'
The "number:" part of the error message always reflects the correct result (i.e. 'number: 3' if there are 3 files in the folder).
What am I missing? I haven't used the Count property before, but I've seen examples of code that use it and I don't see what I'm doing wrong!
Here is the code, with the offending line highlighted:
Code:
Dim objFSO,objSchedFolder,objContents,NumFiles
set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSchedFolder = objFSO.GetFolder("C:\Inetpub\[URL unfurl="true"]wwwroot\_private\Newschedule\")[/URL]
Set objContents = objSchedFolder.Files
[highlight]Set NumFiles = objContents.Count[/highlight]
response.write "Number of files is " & intNumFiles