Solved

Convert text file to excel in VB 6.0

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

707 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

9 Experts available now in Live!

Get 1:1 Help Now