Solved

saving excel 2007 as text file

Posted on 2011-09-20
9
175 Views
Last Modified: 2012-08-13
Hi Experts

I am trying to save a column of numbers enclosed by single quotes and delimited by a comma as a text file. But when I try to do it, each cell is enclosed by double quotes.

So in excel I see this:

'001232',
'003232',
'787201'

and when I view the text file that I have exported I see this:

"'001232',"
"'003232',"
"'787201'"

Does anyone know how I can save cells as a text file - without the extra double quotation marks?

Thanks
0
Comment
Question by:stummj
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 3

Accepted Solution

by:
dahesi earned 500 total points
ID: 36565851
maybe this workaround will help:

search & replace >"< with >< nothing (via notepad).
0
 

Author Comment

by:stummj
ID: 36565878
That was an obvious workaround that I missed! Trying to overengineer this!! Thank you. I'll keep this open in case anyone knows how to do it properly but I will reward you with points before I close the question. Thanks
0
 
LVL 5

Expert Comment

by:DerZauberer
ID: 36565891
Hmm strage. I tried to reproduce, but i get text without double quotes, no matter what output type i choose ...
What is your Cell format like is it "Text"?
What exact formula is shown for your cells?
Is it like this >''001232',< starting with two double quotes?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36566052
Hello,

the data sample that you show above contains the comma within the cell.

'001232',
'003232',
'787201'

If you export that data to a text file, Excel will add double quotes around each cell value that contains a comma, in order to distinguish the comma that is part of the data from the comma that separates the fields in a comma separated file.

Does that make sense?

If you want to avoid the double quotes in the text file, you will need to remove the commas from the cells before saving as text file.

cheers, teylyn
0
 

Author Comment

by:stummj
ID: 36566315
That makes perfect sense teyln - except I'm saving as dos text, so I was expecting like for like. I wasnt saving as a csv. If I remove the comma, Im breaking the integrity of the data, as the data itself needs a comma within the string.
0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36566326
If you need the comma in the data, then you will have to live with the double quotes upon export to txt. The Search and Replace from the first comment seems like the best workaround in that situation.

cheers, teylyn
0
 
LVL 5

Expert Comment

by:DerZauberer
ID: 36587009
Can you try if you still get the double quotes if you save using a macro like this:

ActiveWorkbook.SaveAs Filename:="D:\TEMP\exceltest.txt", FileFormat:= xlTextMSDOS, CreateBackup:=False

Open in new window

0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36590655
Yes, if you export to DOS txt format, the same thing will happen to cells that have commas in the text.

As a workaround, you could copy and paste the cells into a Word document (as unformatted text), then save the Word document as a Plain Text file. Or copy and paste into Notepad or plain text editor.

cheers, teylyn

0
 

Author Closing Comment

by:stummj
ID: 36715135
Thank you very much. Not pretty but a very useable workaround.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question