Solved

How ANSI text file  from vb6

Posted on 2009-07-02
7
533 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
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 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

749 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