Results 1 to 14 of 14

Thread: vb.6 code to read and edit particular line in notepad

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    Is this the sort of thing you were after?

    Sub WriteUTF8()
        Const inFileName As String = "C:\test\test.txt" '"D:\dhananjayan\zimmer\test\trail_test.txt"
        Const outFileName As String = "C:\test\test2.txt"
        With CreateObject("ADODB.Stream")
            .Open
            .LoadFromFile inFileName
            .Type = 2
            .Charset = "UTF-8"
            .ReadText   'read past all existing data
            .Writetext "Here is another line" & vbCrLf
            .SaveToFile outFileName, 2 ' adSaveCreateOverWrite
            .Close
        End With
    End Sub
    Last edited by Aussiebear; 02-02-2025 at 01:49 AM.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •