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.Fi leSystemOb ject")
If objFSO.FileExists(getFile) Then
Set objFile = objFSO.GetFile(getFile)
Else
Set objFile = objFSO.CreateTextFile(getF ile)
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,theNewLi ne-1)
strWriteFile = Right(strWriteFile,Len(str WriteFile) -theNewLin e)
objFile.WriteLine theLine 'THIS IS WHERE IT FAILS
Loop
objFile.WriteLine strWriteFile
End If
Set objFSO = Nothing
Set objFile = Nothing
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.Fi
If objFSO.FileExists(getFile)
Set objFile = objFSO.GetFile(getFile)
Else
Set objFile = objFSO.CreateTextFile(getF
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,theNewLi
strWriteFile = Right(strWriteFile,Len(str
objFile.WriteLine theLine 'THIS IS WHERE IT FAILS
Loop
objFile.WriteLine strWriteFile
End If
Set objFSO = Nothing
Set objFile = Nothing
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
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)
Thanks!
Jay
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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!
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!
EDIT: well, not anymore ;-) thanks!
ASKER
I thought something weird was going on ;-). I think I changed it now.
Yep, thanks again!
Open in new window
Is there data?
try objFile.WriteLine(theLine)