ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Import/Export Text File Tab Delimiter (https://www.excelbanter.com/excel-programming/319285-import-export-text-file-tab-delimiter.html)

Cool Sport

Import/Export Text File Tab Delimiter
 
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!

Patrick Molloy[_2_]

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!


Cool Sport

Import/Export Text File Tab Delimiter
 
Thanks a lot :)



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

Tom Ogilvy

Import/Export Text File Tab Delimiter
 
Here is an additional thought:

If you want Tab delimited, go to File=Save As and select Tab delimited as
the file type.

If you want code, turn on the macro recorder while you do it manually.
(record to a different workbook than the one being saved as a tab delimited
file).

--
Regards,
Tom Ogilvy

"Cool Sport" wrote in message
...
Thanks a lot :)



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





All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com