ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Converting file from XLS to TXT (https://www.excelbanter.com/excel-programming/377915-converting-file-xls-txt.html)

adiacc

Converting file from XLS to TXT
 
HI
I am running some code on a txt file than need to save the file as a TXT but
when I open the TXT file I get a " speach mark at the beginnig of random
lines...as on the EG below:
1234556
"2345678
qwert
asdfg
"2asdfg
why does this appen? and what can I do to prevent it?
Thank you

Tom Ogilvy

Converting file from XLS to TXT
 
Those are usually caused by saving as comma delimited and the cell contains a
comma.

--
Regards,
Tom Ogilvy


"adiacc" wrote:

HI
I am running some code on a txt file than need to save the file as a TXT but
when I open the TXT file I get a " speach mark at the beginnig of random
lines...as on the EG below:
1234556
"2345678
qwert
asdfg
"2asdfg
why does this appen? and what can I do to prevent it?
Thank you


adiacc[_2_]

conevert XLS to TXT
 
Thank you Tom
How could avoid that?
On the excel file I can not see the " and I do not have any commas..
Thank you

Tom Ogilvy

conevert XLS to TXT
 
show the code that saves the file.

--
Regards,
Tom Ogilvy


"adiacc" wrote:

Thank you Tom
How could avoid that?
On the excel file I can not see the " and I do not have any commas..
Thank you


diacci1st

conevert XLS to TXT
 
Hi Tom Thank you again
Well that is the problem
So I have a text file that i need to open in to excel run the below code and
re-save in TXT format:
For Each Cell In Range("A1:A65000")
s = Cell.Value
If Left(s, 1) = "1" Then
i = 208
iloc = InStr(i, s, " ", vbTextCompare)
t = 223
tloc = InStr(t, s, " ", vbTextCompare)

s1 = Left(s, i - 1)
s3 = Right(s, Len(s) - iloc)
s2 = "*************** "
Cell.Value = s1 & s2 & s3

When I re open the file in TXT on random lines I have the " at the begining
of the line:
1234435678
"123456
asdfg
"qwertyuio
But If I look at the file in excel I can not see the " so I can not remove
them.
Can you please help?

Thank you

"Tom Ogilvy" wrote:

show the code that saves the file.

--
Regards,
Tom Ogilvy


"adiacc" wrote:

Thank you Tom
How could avoid that?
On the excel file I can not see the " and I do not have any commas..
Thank you



All times are GMT +1. The time now is 04:30 PM.

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