Link to home
Start Free TrialLog in
Avatar of pplon
pplon

asked on

Convert text file to excel in VB 6.0

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.



Avatar of Mechanic_Kharkov
Mechanic_Kharkov
Flag of Ukraine image

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.
Avatar of pplon
pplon

ASKER

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.
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 ).
ASKER CERTIFIED SOLUTION
Avatar of Mechanic_Kharkov
Mechanic_Kharkov
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial