Friday, July 31, 2009

How to convert a text file to excel using Visual basic?

I need to convert a comma separated txt file to excel sheet using VB. There will be 8 values in each row, which can be fitted to 8 columns of the excel sheet. The txt file contains around 1000 rows. I have to use VB only.


Please help me out.

How to convert a text file to excel using Visual basic?
I'd recommend reading this document (first link below) on the Excel file structure in order to convert it using only VB. Now if you can do it using COM components from MS Office and VB, then you could access MS Office objects that would allow you relatively easily pull in the text (if you have a basic VB skill set already).
Reply:use the microsoft data access com objects to load the "jet" driver. Create a new workbook like you would a new database table, and then insert etc just like a database, then save the file.


No comments:

Post a Comment