last string in txt file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there!

Need Yr help.
I have a simple txt file and need to add "//" (these two symbols) to the end
of the file (last string). Hv tried different ways but always hv carrier
return code between last text string and "//".
example:
text: BLA BLA BLA ->need this BLA BLA BLA//

but always get:
BLA BLA BLA
//

thanks!

exmaple code:
dim nf as integer

nf = freefile

open lpfilename for binary access write as nf
put nf, LOF(nf), "=="
close nf
 
Am Wed, 8 Feb 2006 22:37:26 -0800 schrieb Leech:

Try this please:

Public Sub WriteFile(sPath As String, _
sText As String, _
Optional ByVal bAppend As Boolean _
)
On Error GoTo AUSGANG
Dim lFileNr As Long

lFileNr = FreeFile

Select Case bAppend
Case False
Open sPath For Output As #lFileNr
Case Else
Open sPath For Append As #lFileNr
End Select

Print #lFileNr, sText;

AUSGANG:
If lFileNr Then
Close #lFileNr
End If

If Err.Number Then Err.Raise &H800A0000 Or Err.Number, _
Err.Source, Err.Description, Err.HelpFile, Err.HelpContext
End Sub
 
Back
Top