Salva uma string em um arquivo, sobrescrevendo o arquivo se ele existir.
O FileName pode ser um caminho absoluto ou relativo.
Function WriteFile(ByVal FileName, ByRef Varn)
On Error Resume Next
If Mid(FileName, 2, 1) <> ":" Then
FileName = Server.MapPath(FileName)
End If
If Err Then Err.Clear
On Error GoTo 0
Dim F
Set F = OpenFile(FileName, 2, True)
If F Is Nothing Then
WriteFile = False
Exit Function
End If
On Error Resume Next
F.Write Varn
If Err Then
Err.Clear
F.Close
On Error GoTo 0
WriteFile = False
Exit Function
End If
On Error GoTo 0
F.Close
Set F = Nothing
WriteFile = True
End Function
Nenhum comentário:
Postar um comentário