Solved

Convert text file to excel in VB 6.0

Posted on 2009-04-05
6
1,657 Views
Last Modified: 2013-12-25
Hello.
I would like to convert .txt to .html, change encoding in .html (eg from default UTF-8 to cyrillic) and save the file into excel. Each entry should go into separate columns in excel as the .txt(now .html has delimiters).
Please can you help me with a solution in VB 6.0?

OR is there a direct way to convert characters either of the .txt or .xls file without the .html phase?

Thanks.



0
Comment
Question by:pplon
  • 3
6 Comments
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24070829
You can directly copy / paste unicode data from notepad, for example. There is no need to use html.
Just try to open Your txt file with notepad, copy (with proper input language selected), and paste to Excel.
0
 

Author Comment

by:pplon
ID: 24070871
Sorry, I do not understand you.

The .txt file is the output from the database and this .txt has the encoding UTF-8.  How do I change the UFT-8 to say, cyrillic (dos) in .txt before I move data to excel? I want my VB code to do all these.

Thans very much.
0
 
LVL 5

Expert Comment

by:Mechanic_Kharkov
ID: 24070950
When you open txt file in notepad under Windows XP, it automatically detects Unicode format (e.g. UTF8). Copy, paste, and SaveAs would work with unicode data that you are free to paste anywhere, where unicode is supported. Even if unicode is not supported, clipboard will automatically convert unicode strings into ANSI with current locale in the clipboard.

Of course, if scripting of copy / paste is terrible thing, then there are a couple implementations of UTF8toANSI and back functions in The Net. ( e.g here ).
0
 
LVL 5

Accepted Solution

by:
Mechanic_Kharkov earned 500 total points
ID: 24070977
Excel itself convert txt files when opens them. Look the attached pictures.


Clip-20090405-133433.jpg
Clip-20090405-133510.jpg
Clip-20090405-133543.jpg
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

816 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now