Save workbook as a Text file

M

Mischa

Hi,

I have recorded a macro to store an Excel workbook as a .* txt file.
The result from the macro-recorder is mentioned below

---------------------------------------------------------------------------------
ActiveWorkbook. SaveAs Filename:="C:\Temp\map1.txt", _
FileFormat:=xlTextMSDOS, CreateBackup:=False
---------------------------------------------------------------------------------

If I carry out above action manually the text is taken over exactly the same
as in the workbook,
however if I carry out the action by using the above a macro, some data with
"quotations mark" ("") are stored in the text file.
This only occurs for cells which contains data with a comma:

For example Cell M reads in Excel: NHAVA SHEVA, INDIA but in the text file
"NHAVA SHEVA, INDIA"


Sounds familiar?
How do I have to write my macro that the "quotations mark" will not be
shown?



Thanks in advance,
Mischa


Ps. I am using Excel 2000.
 
M

Mischa

Dear McGimpsey,

Great code, I prefer to use the code:

Public Sub CharacterSV(),

But how can I submit a standard tab as a delimiter iso "|"?


Mischa
 
M

Mischa

Hi McGimpsey,

Chr(9) gave an error message,
so (after searching the web and some other newsgroups) I found vbTab in
stead.

Mischa
 
D

Dave Peterson

vbtab = chr(9)

So I would suspect that it was how you tried to implement it.

But I'm sure J.E. is happy you have a solution.
 
J

JE McGimpsey

Yup, that should've been what I suggested first - it's almost always
better to use the defined constants. Thanks for the update.
 
D

Dave Peterson

I should have looked at your code.

Since DELIMITER was declared as a constant, then chr(9) caused trouble.

sorry for butting in <bg>.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top