How to change xls format to text?

  • Thread starter Thread starter Together
  • Start date Start date
T

Together

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
 
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
 
Back
Top