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

Reply

Join Date: Apr 2007
Posts: 6
Reputation: jetaw03 is an unknown quantity at this point 
Solved Threads: 0
jetaw03 jetaw03 is offline Offline
Newbie Poster

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

 
0
  #1
Apr 20th, 2007
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!
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 186
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

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

 
0
  #2
Apr 20th, 2007
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 .
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 6
Reputation: jetaw03 is an unknown quantity at this point 
Solved Threads: 0
jetaw03 jetaw03 is offline Offline
Newbie Poster

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

 
0
  #3
Apr 22nd, 2007
Originally Posted by aparnesh View Post
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC