ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   text file with tab (https://www.excelbanter.com/excel-programming/335879-text-file-tab.html)

Nazrul[_3_]

text file with tab
 
I would like to export some data (with tab delimiter) from excel, with
HEADER which is string, to .txt file. In exported .txt file, I get quotation
(" ") for string which I don't want. I have written:

Open "test.txt" for output as #1
print #1, "Time", tab, "Average"

for i = 1 to lastrow
Print #1, sheets("test").Cells(i,1), tab, sheets("test").Cells(i,3)
next i

I want the text file as:
Time (Tab) Average
1/1/1999 (Tab) 3.5
1/2/1999 (Tab) 5.5

Could you please help me out?

Thanks,
Nazrul



Chip Pearson

text file with tab
 
Try
Open "H:\test.txt" For Output As #1
Print #1, "Time", vbTab, "Average"
For i = 1 To lastrow
Print #1, Sheets("sheet1").Cells(i, 1), vbTab,
Sheets("sheet1").Cells(i, 3)
Next i
Close #1


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Nazrul" wrote in message
...
I would like to export some data (with tab delimiter) from
excel, with
HEADER which is string, to .txt file. In exported .txt file, I
get quotation
(" ") for string which I don't want. I have written:

Open "test.txt" for output as #1
print #1, "Time", tab, "Average"

for i = 1 to lastrow
Print #1, sheets("test").Cells(i,1), tab,
sheets("test").Cells(i,3)
next i

I want the text file as:
Time (Tab) Average
1/1/1999 (Tab) 3.5
1/2/1999 (Tab) 5.5

Could you please help me out?

Thanks,
Nazrul






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

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