Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Convert a 100,000 character linear text file

I have a 100,000+ character linear text file that I would like convert
to a worksheet.
Each record will be 178 characters long. I feel certain that a visual
basic module would do the
job, but it is beyond my capabilities at this point. Thanks in advance
for any ideas.

Matthew Saxon

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Convert a 100,000 character linear text file

Hi
you may have a look at the following macro
http://support.microsoft.com/default...;EN-US;q120596

though written for Excel 95 the changes for Excel97+ are indicated

--
Regards
Frank Kabel
Frankfurt, Germany

Matthew wrote:
I have a 100,000+ character linear text file that I would like

convert
to a worksheet.
Each record will be 178 characters long. I feel certain that a

visual
basic module would do the
job, but it is beyond my capabilities at this point. Thanks in
advance for any ideas.

Matthew Saxon


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Convert a 100,000 character linear text file

have you tried just opening the file in excel.

when you say linear, do you mean the it is 100,000+ lines long (single
character on each line) and you want to build lines of 178 characters from
that?

Sub ReadStraightTextFile()
Dim sStr as String
Dim LineofText As String
Dim rw as Long
rw = 0
Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1
sStr = ""
Do While Not EOF(1)
Line Input #1, LineofText
sStr = sStr & lineofText
if len(sStr) = 178 then
rw = rw + 1
cells(rw,1).Value = sStr
sStr = ""
End if
Loop
'Close the file
if len(sStr) 0 then
cells(rw,1).Value = sStr
End if
Close #1
End Sub

--
Regards,
Tom Ogilvy

"Matthew" wrote in message
...
I have a 100,000+ character linear text file that I would like convert
to a worksheet.
Each record will be 178 characters long. I feel certain that a visual
basic module would do the
job, but it is beyond my capabilities at this point. Thanks in advance
for any ideas.

Matthew Saxon



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Convert a 100,000 character linear text file

No, sorry. The file is one line with 100,000 plus characters. It is a
file from a bank database.

"Tom Ogilvy" wrote in message
...
have you tried just opening the file in excel.

when you say linear, do you mean the it is 100,000+ lines long (single
character on each line) and you want to build lines of 178 characters

from
that?

Sub ReadStraightTextFile()
Dim sStr as String
Dim LineofText As String
Dim rw as Long
rw = 0
Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1
sStr = ""
Do While Not EOF(1)
Line Input #1, LineofText
sStr = sStr & lineofText
if len(sStr) = 178 then
rw = rw + 1
cells(rw,1).Value = sStr
sStr = ""
End if
Loop
'Close the file
if len(sStr) 0 then
cells(rw,1).Value = sStr
End if
Close #1
End Sub

--
Regards,
Tom Ogilvy

"Matthew" wrote in message
...
I have a 100,000+ character linear text file that I would like

convert
to a worksheet.
Each record will be 178 characters long. I feel certain that a

visual
basic module would do the
job, but it is beyond my capabilities at this point. Thanks in

advance
for any ideas.

Matthew Saxon




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Convert a 100,000 character linear text file

Sub ReadStraightTextFile()
Dim sStr as String
Dim LineofText As String
Dim rw as Long, i as long
rw = 0
Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1
sStr = ""
Do While Not EOF(1)
Line Input #1, LineofText
for i = 1 to len(LineofText)
sStr = sStr & Mid(lineofText,i,1)
if len(sStr) = 178 then
rw = rw + 1
cells(rw,1).Value = sStr
sStr = ""
End if
Next
Loop
'Close the file
if len(sStr) 0 then
cells(rw,1).Value = sStr
End if
Close #1
End Sub

If that doesn't work, we will need to read the line in in pieces - post back
if it doesn't work.

--
Regards,
Tom Ogilvy


"Matthew" wrote in message
...
No, sorry. The file is one line with 100,000 plus characters. It is a
file from a bank database.

"Tom Ogilvy" wrote in message
...
have you tried just opening the file in excel.

when you say linear, do you mean the it is 100,000+ lines long (single
character on each line) and you want to build lines of 178 characters

from
that?

Sub ReadStraightTextFile()
Dim sStr as String
Dim LineofText As String
Dim rw as Long
rw = 0
Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1
sStr = ""
Do While Not EOF(1)
Line Input #1, LineofText
sStr = sStr & lineofText
if len(sStr) = 178 then
rw = rw + 1
cells(rw,1).Value = sStr
sStr = ""
End if
Loop
'Close the file
if len(sStr) 0 then
cells(rw,1).Value = sStr
End if
Close #1
End Sub

--
Regards,
Tom Ogilvy

"Matthew" wrote in message
...
I have a 100,000+ character linear text file that I would like

convert
to a worksheet.
Each record will be 178 characters long. I feel certain that a

visual
basic module would do the
job, but it is beyond my capabilities at this point. Thanks in

advance
for any ideas.

Matthew Saxon






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert fractions from linear to diminuative in Excel? baz.coop55 Excel Worksheet Functions 0 August 4th 08 06:49 AM
character restrictions when importing data from a text file richtea Excel Discussion (Misc queries) 3 September 3rd 05 04:13 PM
How do I convert excel file into ASCII text file with alignment? Rosaiah Excel Discussion (Misc queries) 2 June 27th 05 12:17 PM
how do I convert an excel file to a flat text file Lannutslp Excel Discussion (Misc queries) 1 June 3rd 05 10:17 AM
Convert excel file to flat text file Lannutslp Excel Discussion (Misc queries) 1 June 1st 05 03:48 AM


All times are GMT +1. The time now is 07:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"