LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Create a flat file in Excel

You can try out the below macro. If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub SaveAsDelimitedFile()
Dim intFile As Integer, strData As String, rngRow As Range
Dim strFile As String

intFile = FreeFile
strFile = "c:\test.txt"

Open strFile For Output As #intFile
For Each rngRow In ActiveSheet.UsedRange.Rows
strData = Join(WorksheetFunction.Transpose( _
WorksheetFunction.Transpose(rngRow)), "|")
Print #intFile, strData
Next
Close #intFile

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"GF08" wrote:

I need to create a flat file in Excel using the pipe delimiter | as element,
and carriage return line feed as line delimiter.

How do I do this?



 
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
Transpose Crosstab Data in Excel 2000 to flat file for use in MS A Syak Excel Discussion (Misc queries) 4 August 23rd 06 06:05 PM
Exporting from Excel to a Fixed Length Flat File bearie Excel Worksheet Functions 4 June 16th 05 02:16 AM
how do I convert an excel file to a flat text file Lannutslp Excel Discussion (Misc queries) 1 June 3rd 05 10:17 AM
Convert excel file to flat text file Lannutslp Excel Discussion (Misc queries) 1 June 1st 05 03:48 AM
Convert excel file to flat text file Gary's Student Excel Discussion (Misc queries) 0 June 1st 05 12:17 AM


All times are GMT +1. The time now is 11:39 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"