Solved

How ANSI text file  from vb6

Posted on 2009-07-02
7
528 Views
Last Modified: 2013-11-18
Hi,
I  want to create an ANSI text file from vb6 code. I used to create dhe text file from the FileSystemObject but the file is not in the ANSI format.

Any idea?

Thanks,
Luan
0
Comment
Question by:luani
  • 4
  • 3
7 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24763008
luani said:
>>I used to create dhe text file from the FileSystemObject but the file is not in the ANSI format.

Please post your code.  I use the FSO frequently, and I always get ANSI text back from it...
0
 
LVL 7

Author Comment

by:luani
ID: 24763065
 Set fs = CreateObject("Scripting.FileSystemObject")

    Set a = fs.CreateTextFile(FileName + " " + ConvertDt(Now) + ".txt", True)

    a.WriteLine (str)
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24763101
luani,

OK, now how do you determine the value of your variable str?  Are sticking Unicode text into that variable?

Regards,

Patrick
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 7

Author Comment

by:luani
ID: 24763238
I use normal characters, char(9) to separate values and char(13) for CRLF.
0
 
LVL 7

Author Comment

by:luani
ID: 24763254
I use these files as input in another program which does not recognize them as ANSI. To make them recognizable I use ultraedit to save them as ANSI format. Then everything works fine.
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 125 total points
ID: 24763341
luani said:
>>char(13) for CRLF.

ANSI 13 is just carriage return; typically you want ANSI 13 *and* ANSI 10 as your line delimiters.

Have you tried using vbCrLf instead of Chr(13)?
0
 
LVL 7

Author Comment

by:luani
ID: 24783425
Thank you for your advice! I was betting I had tried this, but it resulted that I didn't.
After the replacement it worked fine!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

765 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