"Object Required".

Results 1 to 2 of 2

Thread: "Object Required".

  1. #1
    Join Date
    Dec 1969

    Default "Object Required".

    My question is for VBScript the latest Windows Script version 5.1<BR><BR>Operating System Windows 95<BR><BR><BR>What I am trying to do is read text from one<BR>file and then place the text in an Excel Spreadsheet.<BR>I know I do not have my Excel Object in this .vbs file.<BR>First I wanted it to work between 2 text files. I get an error<BR>that says "Line8" "Character1" "Object Required".<BR><BR>Can you help me?<BR><BR>Scott<BR>Here is the code:<BR><BR>Dim filesys, testfile, readfile, text, response, contents<BR>Set filesys = CreateObject("Scripting.FileSystemObject")<BR>Set testfile= filesys.CreateTextFile("c: emp1 rain.txt", True)<BR>testfile.Write "A quick example of the Read method"<BR>testfile.close<BR>set readfile = filesys.OpenTextFile("c: emp1 rain.txt", 1, false)<BR>contents = readfile.Read(7)<BR>Response.Write "The first seven characters in the text file are&#039" &<BR>contents & "&#039."<BR><BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Object Requred - .vbs File

    Perhaps the key thing that sticks out is that you mention a ".vbs" file.......if you are using that, then the Response object is not a valid object.....that&#039s for ASP.....to echo output in a vbs file, you can use "WScript.Echo".....so, the last line of your code would become:<BR><BR>Wscript.echo "The first seven characters in the text file are&#039" & contents & "&#039."<BR><BR><BR>James<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts