Ама това става и на един ред:
Public Sub save_txt_file(sPath As String, sContent As String)
CreateObject("Scripting.FileSystemObject").OpenTextFile(sPath, 2, True).Write sContent
End Sub
Но аз предпочитам вградените оператори за работа с файлове -- по-бързи са:
Public Sub save_txt_file2(sPath As String, sContent As String)
Dim nFile As Integer
On Error Resume Next
SetAttr sPath, vbNormal
Kill sPath
On Error GoTo EH
nFile = FreeFile()
Open sPath For Binary Access Write As #nFile
Put #nFile, , sContent
EH:
If nFile Then
Close #nFile
End If
End Sub
cheers,
</wqw>