Marceepoo
2006-11-04 19:22:01 UTC
Line 24 generates the following error: Invalid procedure call or argument
Error 800A00005
The script below runs fine if I comment out lines 24-26, but I need to
create the text file that those lines are intended to create.
Does anyone...
1. Know how to fix those lines so that they work? and
2. Know where I can find reading material so that I would know how to do it
right, i.e., what I'm doing wrong?
Thanks in advance for your time and help.
Marceepoo
'Canniablized from Hey_Scripting_Guy.chm
'
'Get a List of All the Files in a Folder and Its Subfolders
'
'
'
sFileList = ""
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "o:\"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
sFileList = sFileList & objFile.Name & vbCrLf
'Wscript.Echo objFile.Name
Next
ShowSubfolders objFSO.GetFolder(objStartFolder)
WScript.Echo sFileList
'Set objFile = objFSO.OpenTextFile("o:\NewFile.txt", ForWriting)
'objFile.WriteLine sFileList
'objFile.Close
Sub ShowSubFolders(Folder)
For Each Subfolder in Folder.SubFolders
'Wscript.Echo Subfolder.Path
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
'Wscript.Echo objFile.Name
sFileList = sFileList & objFile.Name & vbCrLf
Next
'Wscript.Echo
ShowSubFolders Subfolder
Next
End Sub
Error 800A00005
The script below runs fine if I comment out lines 24-26, but I need to
create the text file that those lines are intended to create.
Does anyone...
1. Know how to fix those lines so that they work? and
2. Know where I can find reading material so that I would know how to do it
right, i.e., what I'm doing wrong?
Thanks in advance for your time and help.
Marceepoo
'Canniablized from Hey_Scripting_Guy.chm
'
'Get a List of All the Files in a Folder and Its Subfolders
'
'
'
sFileList = ""
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "o:\"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
sFileList = sFileList & objFile.Name & vbCrLf
'Wscript.Echo objFile.Name
Next
ShowSubfolders objFSO.GetFolder(objStartFolder)
WScript.Echo sFileList
'Set objFile = objFSO.OpenTextFile("o:\NewFile.txt", ForWriting)
'objFile.WriteLine sFileList
'objFile.Close
Sub ShowSubFolders(Folder)
For Each Subfolder in Folder.SubFolders
'Wscript.Echo Subfolder.Path
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
'Wscript.Echo objFile.Name
sFileList = sFileList & objFile.Name & vbCrLf
Next
'Wscript.Echo
ShowSubFolders Subfolder
Next
End Sub