Append textfile to textfile /Excel 2003 macro

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • asedt
    New Member
    • Jun 2008
    • 130

    Append textfile to textfile /Excel 2003 macro

    With my Excel macro and two text files I want to create a new textfile containing the first textfile then text from the sheet and then the second textfile.

    My problem is that i don't know how to append the second textfile.

    Code:
    Sub mysub()
        Dim TempString As String
    
        'Open the first file 
        Dim fileA As Integer
        fileA = FreeFile()
        Open "C:\A\B\C1.txt" For Append As fileA
    
        'Here i will later append stuff from the Excell sheet
        TempString = "Hello1"
        Print #fileA, TempString
        Print #fileA, TempString
    
        'Open the last part of the textfile
        Dim EndPart As Integer
        EndPart = FreeFile()
        Open "C:\A\B\D2.txt" For Input As EndPart
        
        'Here I want to append #EndPart to #fileA 
        
        Close EndPart
        Close SVGfile
    End Sub
    Followed this:
  • asedt
    New Member
    • Jun 2008
    • 130

    #2



    Used that and got it working wery good for me.

    Comment

    Working...