944,147 Members | Top Members by Rank

Ad:
Apr 20th, 2007
0

getting data from a text file and putting it in an excel file using visual basic 6.0

Expand Post »
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!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jetaw03 is offline Offline
6 posts
since Apr 2007
Apr 20th, 2007
0

Re: getting data from a text file and putting it in an excel file using visual basic 6.0

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
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim objExcel As Excel.Application
  2. Set objExcel = New Excel.Application
  3. objExcel.Workbooks.Add 'Creates a New Excel File
  4. objExcel.ActiveWorkbook.Sheets(1).Activate
  5. Dim RowNum As Integer
  6. RowNum = 1
  7. Dim ColNum As Integer
  8. ColNum = 1
  9.  
  10. For X = 1 To 10
  11. objExcel.Cells(RowNum, ColNum) = X
  12. ColNum = ColNum + 1
  13. 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 .
Reputation Points: 20
Solved Threads: 10
Junior Poster
aparnesh is offline Offline
193 posts
since Jul 2005
Apr 22nd, 2007
0

Re: getting data from a text file and putting it in an excel file using visual basic 6.0

Click to Expand / Collapse  Quote originally posted by aparnesh ...
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
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim objExcel As Excel.Application
  2. Set objExcel = New Excel.Application
  3. objExcel.Workbooks.Add 'Creates a New Excel File
  4. objExcel.ActiveWorkbook.Sheets(1).Activate
  5. Dim RowNum As Integer
  6. RowNum = 1
  7. Dim ColNum As Integer
  8. ColNum = 1
  9.  
  10. For X = 1 To 10
  11. objExcel.Cells(RowNum, ColNum) = X
  12. ColNum = ColNum + 1
  13. 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jetaw03 is offline Offline
6 posts
since Apr 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Loading external file from within program
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Uninstaller for VB6





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC