Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error '800a01a8' using Count property 1

Status
Not open for further replies.

shaferbus

MIS
Dec 7, 2002
130
US
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:

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
 
Remove Set from highlighted line... this is for objects. :)

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.

[ba
 
Oh Geez!
I knew it had to be something painfully obvious [hairpull]
Thanks vongrunt!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top