| Re: Script to print all files in folder and subfolders strDirectory = "E:\Code\SQL"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strDirectory)
Set colItems = objFolder.Items
For Each objItem in colItems
objItem.InvokeVerbEx("Edit")
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objMainFolder = objFSO.GetFolder(strDirectory)
Set colSubfolders = objMainFolder.Subfolders
For Each objSubfolder in colSubfolders
strFolder = objSubfolder.Path
GetFiles strFolder
Next
sub GetFiles(byval strDirectory)
Set objWeeFolder = objShell.Namespace(strDirectory)
Set colWeeItems = objWeeFolder.Items
For Each objWeeItem in colWeeItems
objWeeItem.InvokeVerbEx("Edit")
Next
end sub
This works!
Maybe a bit clumsy, but I was able to go through to a subfolder and loop through the items in that.
It currently only goes down 1 level, but could be changed to loop through other subfolders.
I just sepnt 45 minutes on that, and enjoyed every minute of it.
Work from work, although VBS is fucking old school.
Oh, and obviously change "Edit" to "Print"
__________________ You just lost The Game
If animal trapped call 844-6286
Last edited by Zooropa; 21st February 2008 at 7:48pm.
Reason: Automerged Doublepost
|