View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default Import/Export Text File Tab Delimiter

method (1)
copy the range to a new workbook, then saevas using the CSV as a delimer

Option Explicit

Sub SaveToCSV()

Dim Source As Range
Dim wb As Workbook

Set Source = Range("MyData")

Set wb = Workbooks.Add()

wb.ActiveSheet.Range(Source.Address).Value = Source.Value

wb.SaveAs "c:\temp\MyCSV.csv", xlCSV

wb.Close False

End Sub

Method(2)
OPEN a stream to a text file & write the data line by line. Build the line
using a FOR...NEXT loop concotenating the cell values with a ";" .... much to
tedious!

HTH
Patrick Molloy
Microsoft Excel MVP




"Cool Sport" wrote:

Hi there,

I would like to import/export data to text files using tab delimiter.
This helps user to save/load configurations or share them with others.

I know how to import a text file to a range. How can I export a range of
cells into a text file so that it can be loaded later.

Regards,

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!