Solved

Convert text file to excel in VB 6.0

Posted on 2009-04-05
6
1,653 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 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…

863 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

20 Experts available now in Live!

Get 1:1 Help Now