Solved

saving excel 2007 as text file

Posted on 2011-09-20
9
173 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
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…

809 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