Link to home
Start Free TrialLog in
Avatar of jayligda
jayligda

asked on

Object doesn't support this property or method: 'objFile.WriteLine'

Hi,

I have a script that is supposed to get a remote file and write it locally but I get "Object doesn't support this property or method: 'objFile.WriteLine'" when I try to write.  I have this working on other scripts, but can't seem to figure why it is not working on this script.  Here is code:


    Set objFSO = CreateObject("Scripting.FileSystemObject")
   
    If objFSO.FileExists(getFile) Then
        Set objFile = objFSO.GetFile(getFile)
    Else
        Set objFile = objFSO.CreateTextFile(getFile)
    End If
   
    If objFile.Size > 0 Then
        ' Code to verify file
    Else
   
        strWriteFile = strCompleteFile 'Code from remote file

        Do While InStr(strWriteFile,Chr(10))

            theNewLine = InStr(strWriteFile,Chr(10))
            theLine = Left(strWriteFile,theNewLine-1)
            strWriteFile = Right(strWriteFile,Len(strWriteFile)-theNewLine)
   
            objFile.WriteLine theLine 'THIS IS WHERE IT FAILS

        Loop
   
        objFile.WriteLine strWriteFile
   
    End If      

Set objFSO = Nothing
Set objFile = Nothing
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Before  objFile.WriteLine theLine 'THIS IS WHERE IT FAILS add

response.write "theLine: "&theLine
response.wend
 objFile.WriteLine theLine 'THIS IS WHERE IT FAILS

Open in new window


Is there data?

try  objFile.WriteLine(theLine)
Avatar of jayligda
jayligda

ASKER

Yes, I could have mentioned I tested that already.  Here is the response line:

theLine: %CTF: 1.00

I should note that I now get the error:

Object doesn't support this property or method: 'wend'

I also did try objFile.WriteLine(theLine) as well to get the same results.

Thanks!

Jay
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've requested that this question be closed as follows:

Accepted answer: 0 points for jayligda's comment #a39637240

for the following reason:

Yep, that did it.  I have my file(s)!  Thanks!
That seems like a positive response but are you aware you have selected your own comment as a solution?

EDIT: well, not anymore ;-) thanks!
I thought something weird was going on ;-).  I think I changed it now.
Yep, thanks again!