guys, can you help me to get data from a text file and putting it in an excel file? my programming language is visual basic 6.0

here is a sample data from the text file:

ANO,BNO,TRANSDATE,TRANSTIME,ORIGINS,DESTINATION,CA LL_TYPE,OUTROUTE,INROUTE,CALLS,ACTUAL_MINS,COST
0498373386,006623322001,20070216,16:33:35,SRO,THB,IDD,IBEF7O,,1,0.766666666666667,-0.014413
0498373386,006623322001,20070223,12:59:40,SRO,THB, IDD,0241,,1,0.8,-0.01264
0498373521,0096265522113,20070207,11:22:59,SRO,JO, IDD,0241,,1,0.433333333333333,-0.019717

i wll get the underlined data, then i will put in an excel file..

pls help me guys..its only a project but i really need your help.i am only an amatuer vb programmer and my knowledge in it is limited.pls help..tnx!

Recommended Answers

All 2 Replies

Putting data into Excel File is not a big problem. In the VB project Refernces add the "Microsoft Excel X Object Library" where X will depend on whatever version of Excel you have in the computer.

Here's a Code snippet for sending data to Excel

Dim objExcel As Excel.Application
Set objExcel = New Excel.Application
    objExcel.Workbooks.Add                  'Creates a New Excel File
    objExcel.ActiveWorkbook.Sheets(1).Activate
    Dim RowNum As Integer
    RowNum = 1
    Dim ColNum As Integer
    ColNum = 1
    
    For X = 1 To 10
            objExcel.Cells(RowNum, ColNum) = X
            ColNum = ColNum + 1
    Next

This will put the Numbers 1..10 in the Excel Cells A1...A10.

But I am not sure how you can extract only the underlined data ? What sort of input file are you using ? Surely it's not a .txt file as that does not support font underline .

Putting data into Excel File is not a big problem. In the VB project Refernces add the "Microsoft Excel X Object Library" where X will depend on whatever version of Excel you have in the computer.

Here's a Code snippet for sending data to Excel

Dim objExcel As Excel.Application
Set objExcel = New Excel.Application
    objExcel.Workbooks.Add                  'Creates a New Excel File
    objExcel.ActiveWorkbook.Sheets(1).Activate
    Dim RowNum As Integer
    RowNum = 1
    Dim ColNum As Integer
    ColNum = 1
 
    For X = 1 To 10
            objExcel.Cells(RowNum, ColNum) = X
            ColNum = ColNum + 1
    Next

This will put the Numbers 1..10 in the Excel Cells A1...A10.

But I am not sure how you can extract only the underlined data ? What sort of input file are you using ? Surely it's not a .txt file as that does not support font underline .

tnx for the code.i will try that now.the underlined data are the ones which i will be putting in an existing excel file.but it doesn't mean it is underlined as it is. i only underlined it so that you guys will know the data that i will be getting.and the dat is in a text file.my question is what is the code in getting the data in the text file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.