Vbs Object required: '' (error on Line 5)(letter 1)


  1. Posts : 50
    Windows 8.1 x64
       #1

    Vbs Object required: '' (error on Line 5)(letter 1)


    as it says in the title

    Option Explicit
    dim custFolder, folder

    custFolder=InputBox("Type custom path")
    Folder.CreateFolder "C:\" & custFolder & "folder1"
      My Computer


  2. Posts : 2,468
    Windows 7 Ultimate x64
       #2

    In line 5 it says
    Code:
    Folder.CreateFolder "C:\" & custFolder & "folder1"
    It uses a method on the Folder variable but problem is that it was declared (on line 2) but never initialized to anything, hence the error.

    What is lacking is creating the "file system object" before using it:
    Code:
    Set folder=CreateObject("Scripting.FileSystemObject")
      My Computer


  3. Posts : 50
    Windows 8.1 x64
    Thread Starter
       #3

    Alejandro85 said:
    In line 5 it says
    Code:
    Folder.CreateFolder "C:\" & custFolder & "folder1"
    It uses a method on the Folder variable but problem is that it was declared (on line 2) but never initialized to anything, hence the error.

    What is lacking is creating the "file system object" before using it:
    Code:
    Set folder=CreateObject("Scripting.FileSystemObject")
    thanks that did the trick
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 06:22.
Find Us