Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / October 2004

Tip: Looking for answers? Try searching our database.

Save workbook as a Text file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mischa - 27 Oct 2004 14:38 GMT
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.
JE McGimpsey - 27 Oct 2004 15:39 GMT
one way:

  http://www.mcgimpsey.com/excel/textfiles.html#csvnoquotes

> How do I have to write my macro that the "quotations mark" will not be
> shown?
Mischa - 28 Oct 2004 08:02 GMT
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

> one way:
>
>   http://www.mcgimpsey.com/excel/textfiles.html#csvnoquotes
>
>> How do I have to write my macro that the "quotations mark" will not be
>> shown?
JE McGimpsey - 28 Oct 2004 13:25 GMT
Use Chr(9)

> But how can I submit a standard tab as a delimiter iso "|"?
Mischa - 28 Oct 2004 14:27 GMT
Hi McGimpsey,

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

Mischa

> Use Chr(9)
>
>> But how can I submit a standard tab as a delimiter iso "|"?
Dave Peterson - 28 Oct 2004 16:13 GMT
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.

> Hi McGimpsey,
>
[quoted text clipped - 7 lines]
> >
> >> But how can I submit a standard tab as a delimiter iso "|"?

Signature

Dave Peterson
ec35720@msn.com

JE McGimpsey - 28 Oct 2004 16:17 GMT
Yup, that should've been what I suggested first - it's almost always
better to use the defined constants. Thanks for the update.

> Chr(9) gave an error message,
> so (after searching the web and some other newsgroups) I found vbTab in
> stead.
Dave Peterson - 28 Oct 2004 16:54 GMT
I should have looked at your code.

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

sorry for butting in <bg>.

> Yup, that should've been what I suggested first - it's almost always
> better to use the defined constants. Thanks for the update.
>
> > Chr(9) gave an error message,
> > so (after searching the web and some other newsgroups) I found vbTab in
> > stead.

Signature

Dave Peterson
ec35720@msn.com

JE McGimpsey - 28 Oct 2004 17:17 GMT
Don't be sorry - I screwed it up on my web page, too. Now fixed.

> I should have looked at your code.
>
> Since DELIMITER was declared as a constant, then chr(9) caused trouble.
>
> sorry for butting in <bg>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.