By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,098 Members | 717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,098 IT Pros & Developers. It's quick & easy.

Append textfile to textfile /Excel 2003 macro

P: 125
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.

Expand|Select|Wrap|Line Numbers
  1. Sub mysub()
  2.     Dim TempString As String
  4.     'Open the first file 
  5.     Dim fileA As Integer
  6.     fileA = FreeFile()
  7.     Open "C:\A\B\C1.txt" For Append As fileA
  9.     'Here i will later append stuff from the Excell sheet
  10.     TempString = "Hello1"
  11.     Print #fileA, TempString
  12.     Print #fileA, TempString
  14.     'Open the last part of the textfile
  15.     Dim EndPart As Integer
  16.     EndPart = FreeFile()
  17.     Open "C:\A\B\D2.txt" For Input As EndPart
  19.     'Here I want to append #EndPart to #fileA 
  21.     Close EndPart
  22.     Close SVGfile
  23. End Sub
Followed this:
Oct 14 '08 #1
Share this Question
Share on Google+
1 Reply

P: 125

Used that and got it working wery good for me.
Oct 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.