Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Visual Basic 6 - String Reading

In the following module, the strings are read into an array. But, the Input
statement terminates the string as soon as it encounters a comma instead of
reaching upto CRLF. Accordingly, the number of strings is more than actual
number of lines. Why?

j = 1
Do While Not EOF(1)
Input #1, A$
intStrLen = Len(A$)
For i = 1 To intStrLen
arrIn(j) = Left(A$, 1)
j = j + 1
A$ = Right(A$, Len(A$) - 1)
Next i
arrIn(j) = vbCr
arrIn(j + 1) = vbLf
j = j + 2
Loop
intLen = j

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Visual Basic 6 - String Reading

Why? Because you aren't using Input correctly.

Use

Line Input #FileNum, A$

HTH,
Bernie
MS Excel MVP


"V Govindan" wrote in message
...
In the following module, the strings are read into an array. But, the Input
statement terminates the string as soon as it encounters a comma instead of
reaching upto CRLF. Accordingly, the number of strings is more than actual
number of lines. Why?

j = 1
Do While Not EOF(1)
Input #1, A$
intStrLen = Len(A$)
For i = 1 To intStrLen
arrIn(j) = Left(A$, 1)
j = j + 1
A$ = Right(A$, Len(A$) - 1)
Next i
arrIn(j) = vbCr
arrIn(j + 1) = vbLf
j = j + 2
Loop
intLen = j



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Visual Basic 6 - String Reading

How silly of me! It is really very nice that You took the trouble of
answering. Such help to developers will be very useful.
Thank you again.
Regards,
V Govindan

"Bernie Deitrick" wrote:

Why? Because you aren't using Input correctly.

Use

Line Input #FileNum, A$

HTH,
Bernie
MS Excel MVP


"V Govindan" wrote in message
...
In the following module, the strings are read into an array. But, the Input
statement terminates the string as soon as it encounters a comma instead of
reaching upto CRLF. Accordingly, the number of strings is more than actual
number of lines. Why?

j = 1
Do While Not EOF(1)
Input #1, A$
intStrLen = Len(A$)
For i = 1 To intStrLen
arrIn(j) = Left(A$, 1)
j = j + 1
A$ = Right(A$, Len(A$) - 1)
Next i
arrIn(j) = vbCr
arrIn(j + 1) = vbLf
j = j + 2
Loop
intLen = j




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
Micrsoft Visual Basic Compile error: Expected: end of statement IJ Excel Discussion (Misc queries) 5 October 23rd 06 12:08 AM
macro unouwanme Excel Discussion (Misc queries) 9 August 31st 06 09:38 PM
List File Properties - Author SS Excel Worksheet Functions 1 June 23rd 06 04:56 PM
Visual Basic and SP2 JessJ Excel Discussion (Misc queries) 2 October 6th 05 12:17 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 06:54 AM.

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

About Us

"It's about Microsoft Excel"