Lost Password?


Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-04-2007, 11:55 AM
u2cannv u2cannv is offline
Newbie
 
Join Date: Oct 2007
Posts: 9
Rep Power: 0
u2cannv is on a distinguished road
Default Basic

Here's my problem, I have a .txt file that contains data that needs to be seperated by tabs and cant figure out how to write a code that will seperate the data for me. So that when I pull it into excel it's not read as one big cell of information, instead its seperated by tabs. Any help or direction to where i could go would be helpful. I'm programming in BASIC and the compiler is BASIC IDE. thanks in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 10-04-2007, 12:08 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

I'm a little confused so let me see if I understand.

You have a txt document but do or don't want it to be tab delimited?

You want to open it and it be in one big cell or not?

If you want it to be in separate cells you need to delimited by commas and name the file .csv.
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-04-2007, 12:10 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,278
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default

Do you know something more precise for where to insert the tabs?
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-04-2007, 01:12 PM
u2cannv u2cannv is offline
Newbie
 
Join Date: Oct 2007
Posts: 9
Rep Power: 0
u2cannv is on a distinguished road
Default

Thanks for your help so far, I have txt file that needs to be tab delimited. I would like to do a find a replace with tabs. the character that is being replaced is (|) this in not an "L" by the way. so i'm not sure if how to write the code for that.
Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-04-2007, 01:48 PM
kkelly's Avatar   
kkelly kkelly is offline
Learning Programmer
 
Join Date: Sep 2007
Posts: 50
Rep Power: 5
kkelly is on a distinguished road
Default

I'm not sure if this is the type of solution you are looking for, but when importing external data into excel you can specify the delimiting character in the Import Text Wizard. Just uncheck the "Tab" box and check "Other", then specify the | character in the following text box.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 10-04-2007, 01:52 PM
u2cannv u2cannv is offline
Newbie
 
Join Date: Oct 2007
Posts: 9
Rep Power: 0
u2cannv is on a distinguished road
Default

thank you for your reply, but I know how to do that. I'm trying to automate the process so I wont have to do that (LOL). I know that it's probably something simple, but can't put my hands around it. When i pull the file into excel its not recognizing the tabs, it just reads it as spaces and continues putting all the information into that one block of cell. It's really frustrating, so I'm not sure what i need to do?????? any suggestions or website are helpful.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 10-04-2007, 01:56 PM
u2cannv u2cannv is offline
Newbie
 
Join Date: Oct 2007
Posts: 9
Rep Power: 0
u2cannv is on a distinguished road
Default

yes the tabs needs to be replaced inbetween "|" this is the bar character. Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 10-05-2007, 12:20 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,278
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default

I would just read the source file one character at a time, replacing the | with [tab] when encountered, then write the character to a new file. You just need to do a little experimenting to figure out the ASCII code for | and [tab].
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 10-05-2007, 10:24 PM
ghostdog74 ghostdog74 is offline
Newbie
 
Join Date: Apr 2007
Posts: 6
Rep Power: 0
ghostdog74 is on a distinguished road
Default

assumed input data like this:
123|456|789
one|two|three

Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
objSheet.Cells(1, 1).Value = "First Column header"
objSheet.Cells(1, 2).Value = "Second column header"
objSheet.Cells(1, 2).Value = "third column header"
r = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
myFile = "c:\temp\a.txt"
Set objFile = objFSO.OpenTextFile(myFile,1)
Do Until objFile.AtEndOfStream
	line = Split(Replace(objFile.ReadLine,"|",vbTab),vbTab )
	WScript.Echo line(1)
	objSheet.Cells(r, 1).Value = line(0)
	objSheet.Cells(r, 2).Value = line(1)
	objSheet.Cells(r, 3).Value = line(2)
	r=r +1
Loop
objExcel.ActiveWorkbook.SaveAs "c:\test.xls"
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
when done, an excel file will be created
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Contest: C# vs. Java vs. Visual Basic Jordan General Programming 259 11-10-2008 03:53 PM
HTML Basic Formatting clookid Tutorials 14 03-06-2007 04:10 PM
My friend made some cool BASIC videos elfshadow14 The Lounge 5 01-09-2007 11:20 PM
Graphical programming add-in for Visual Basic 6.0 xXHalfSliceXx Visual Basic Programming 10 01-03-2007 08:14 AM
Parallel Port Programming Using Visual Basic kevintcp85 Visual Basic Programming 12 12-06-2006 01:09 PM


All times are GMT -5. The time now is 06:47 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads