Solved

How ANSI text file  from vb6

Posted on 2009-07-02
7
538 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

738 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