LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default appending to .txt file format problems


I currently have the following code. It basically appends a chunk of
data at the end of a .txt file. However, the way its formatting is not
what I want. Currently, it takes each cell in Range(A1:J?) and makes
it's own row in the .txt file. I want a tab delimited file that
maintains the column-like format A:J.
Example:
What I have and don't want in the .txt file:

Data1
Data2
Data3
etc.

What I need:

Data1 Data2 Data3 ....Data8
Data9 Data10 ........Data16 etc.





Sub XfertoNotepad()

Dim FileNum As Integer
Sheets("SQL").Select
Range("A2").Select
With ActiveSheet
Set Lend = .Cells(.Rows.Count, "J").End(xlUp)
End With


FileNum = FreeFile


Open "C:\4x\" & docsol For Append As #FileNum


Print #FileNum, [a2]
For Each cl In Range("A3:" & Lend)

Print #FileNum, myStr
myStr = "": myStr = myStr & cl
Next
'appends the input to an existing file write to the textfile
Print #FileNum, myStr
Close #FileNum ' close the file
End Sub


--
pikapika13
------------------------------------------------------------------------
pikapika13's Profile: http://www.excelforum.com/member.php...o&userid=10892
View this thread: http://www.excelforum.com/showthread...hreadid=566906

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems appending cells together ChrisL Excel Worksheet Functions 5 August 20th 06 12:03 AM
Excel 2007 File Problems (Opening New Format) Grazen Excel Discussion (Misc queries) 2 July 21st 06 04:24 PM
Appending to a Cell doesn't keep format of existing content DejaUser Excel Programming 3 January 25th 06 09:43 PM
Appending a second csv file Rick Excel Discussion (Misc queries) 3 March 9th 05 06:21 PM
Appending to File Progster Excel Programming 1 September 22nd 03 02:24 PM


All times are GMT +1. The time now is 03:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"