ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to change xls format to text? (https://www.excelbanter.com/excel-programming/293360-how-change-xls-format-text.html)

Together[_9_]

How to change xls format to text?
 
Hi, Everybody,

Now I have a problem about the format changes. I have a document i
Excel, and I want to change the excel file to text file. For instance
in excel, the value in Cells(1,A)=5, Cells(1,B)=6
I want the file in text is like: 56. But generally, when I transfer th
file, I find that in text it is 5 6. There is a space between 5 and 6
How can I delete the space? Thank you

--
Message posted from http://www.ExcelForum.com


JE McGimpsey

How to change xls format to text?
 
One way:


Public Sub NullSV()
Dim myRecord As Range
Dim myField As Range
Dim sOut As String

Open "Test.txt" For Output As #1
For Each myRecord In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
With myRecord
For Each myField In Range(.Cells, _
Cells(.Row, Columns.Count).End(xlToLeft))
sOut = sOut & myField.Text
Next myField
Print #1, sOut
sOut = Empty
End With
Next myRecord
Close #1
End Sub


In article ,
Together wrote:

Hi, Everybody,

Now I have a problem about the format changes. I have a document in
Excel, and I want to change the excel file to text file. For instance,
in excel, the value in Cells(1,A)=5, Cells(1,B)=6
I want the file in text is like: 56. But generally, when I transfer the
file, I find that in text it is 5 6. There is a space between 5 and 6.
How can I delete the space? Thank you.



All times are GMT +1. The time now is 11:25 PM.

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