Abre um arquivo e retorna um objeto TextStream.
O FileName pode ser um caminho absoluto ou relativo.
Function OpenFile(ByVal FileName, ByVal oMode, ByVal Create)
Dim FSO, F
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
On Error Resume Next
If Mid(FileName, 2, 1) <> ":" Then
FileName = Server.MapPath(FileName)
End If
If Err Then Err.Clear
Set F = FSO.OpenTextFile(FileName, oMode, Create)
If Err Then
Err.Clear
On Error GoTo 0
Set FSO = Nothing
Set OpenFile = Nothing
Exit Function
End If
On Error GoTo 0
Set OpenFile = F
Set FSO = Nothing
End Function
Nenhum comentário:
Postar um comentário