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

100+
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
  3.  
  4.     'Open the first file 
  5.     Dim fileA As Integer
  6.     fileA = FreeFile()
  7.     Open "C:\A\B\C1.txt" For Append As fileA
  8.  
  9.     'Here i will later append stuff from the Excell sheet
  10.     TempString = "Hello1"
  11.     Print #fileA, TempString
  12.     Print #fileA, TempString
  13.  
  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
  18.  
  19.     'Here I want to append #EndPart to #fileA 
  20.  
  21.     Close EndPart
  22.     Close SVGfile
  23. End Sub
  24.  
Followed this:
http://www.xtremevbtalk.com/showthread.php?t=123814
Oct 14 '08 #1
Share this Question
Share on Google+
1 Reply

100+
P: 125
http://www.microsoft.com/technet/scr...4/hey1201.mspx


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.