By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,461 Members | 1,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,461 IT Pros & Developers. It's quick & easy.

Microsoft VBScript runtime error '800a01a8': Object required: 'objFolder'

P: 13
Greetings All,

I'm new to this forum as well as to ASP. Therefore I am ready to learn from the ASP experts in this forum. Thank you very much in advance.

I was assign to develop a ASP based website, and one of the functions offer in this site is that the end user is able to print all files located in a specific folder, and the files were actually generated in the folder based on the end user selection. After printing, the files will be remove and left the folder empty. I already handled the files creation and file deletion part but what make me the most headache is the printing part. I have this chunk of code which supposed to perform the printing but it keeps returning me error of: Object required: 'objFolder'. I have no idea how to go about this and hope someone can give me some guide line. Below is my chunk of code.

TargetFolder = "C:\dummy\"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(TargetFolder)
Set colItems = objFolder.Items
For Each objItem in colItems

May I know what is my mistake? Perhaps do you have any better idea on how to print all files from a folder? Thank you very much.

Best Regards
Gray d Newbie
Jul 31 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 432
Here is ASP code to populate a drop down list with files from a folder.

Expand|Select|Wrap|Line Numbers
  1.   <%
  2. FolderPath = Request.ServerVariables("APPL_PHYSICAL_PATH") & "..\wwwroot\"
  3. set Folders = FSObject.GetFolder(FolderPath)
  4. set FileList = Folders.SubFolders
  5. response.write "<select name=txtClassFolder>"
  6. response.write "<option selected>Choose Folder</option>"
  8. for each FoundFolders in FileList
  9.     response.write "<option>" 
  10.     response.write 
  11.     response.write "</option>"
  12. next
  13. response.write "</select>"                    
  15. %>
Aug 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.