469,612 Members | 1,626 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,612 developers. It's quick & easy.

Append textfile to textfile /Excel 2003 macro

125 100+
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
1 2642
asedt
125 100+
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.

Similar topics

1 post views Thread by Steven Stewart | last post: by
17 posts views Thread by Mansi | last post: by
7 posts views Thread by Holger Fitschen | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.