View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
cum.nex cum.nex is offline
external usenet poster
 
Posts: 2
Default Problem reading text file

From an Ecel-VB macro I need to do the following:
1) open a text file for reading (in my case. a mail message file)
Dim fileIn As String
Dim thisLine(500) As String
Open fileIn For Input As #1
Open fileOut For Output As #2
2) read each line from this file
Input #1, thisLine
3) process the line and then write it to an output text file, similar
to the input one.

Problem.
Lines like the following ones (I add CRLF to display the carriage
return chars):
Received: from smtp-in10.gmail.com (192.168.32.68) by ims88c.gmail.com
(18.0.024.3)CRLF
id 47DA621000B94BAB for ; Wed, 28 May 2008
20:00:24 +0200CRLF
Received: from outrelay05.gmail.com (172.31.0.121) by smtp-
in10.gmail.com (7.3.120)CRLF
id 4611FE643F754F89 for
; Wed, 28 May 2008
20:00:24 +0200CRLF

are read from the macro as:
Received: from smtp-in10.gmail.com (192.168.32.68) by ims88c.gmail.com
(18.0.024.3)
id 47DA621000B94BAB for
; WedCRLF
28CRLF
May 2008 20:00:24 +0200CRLF
Received: from outrelay05.gmail.com (172.31.0.121) by smtp-
in10.gmail.com (7.3.120)
id 4611FE643F754F89 for
; WedCRLF
28CRLF
May 2008 20:00:24 +0200CRLF

That is:
1) spaces at the beginning of the line are trimmed (" id
4611FE643"...)
2) lines are split ("Wed, 28 May"...)

Why and which solution?
Thanks.