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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gray d newbie
    New Member
    • Jul 2008
    • 13

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

    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("S hell.Applicatio n")
    Set objFolder = objShell.Namesp ace(TargetFolde r)
    Set colItems = objFolder.Items
    For Each objItem in colItems
    objItem.InvokeV erbEx("Print")
    Next

    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
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    Here is ASP code to populate a drop down list with files from a folder.

    Code:
      <%
    FolderPath = Request.ServerVariables("APPL_PHYSICAL_PATH") & "..\wwwroot\"
    set Folders = FSObject.GetFolder(FolderPath)
    set FileList = Folders.SubFolders
    response.write "<select name=txtClassFolder>"
    response.write "<option selected>Choose Folder</option>"
    'LOOP THROUGH ITEM TYPES TO POPULATE DROP DOWN
    for each FoundFolders in FileList
    	response.write "<option>" 
    	response.write FoundFolders.name 
    	response.write "</option>"
    next
    response.write "</select>"					
    
    %>

    Comment

    Working...