Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OpenText method won't read text files without "MIME-version" line in the header!

3 views
Skip to first unread message

Bill Renaud

unread,
Mar 11, 2004, 5:05:20 PM3/11/04
to
I have an Excel VBA macro that reads in e-mail messages that have been saved
in raw format to a text file from an commercial e-mail filtering program.
The goal was to improve the filtering by seeing what HTML tags were being
used by spammers. Each file contains the full e-mail header, a blank line,
and the body of the e-mail, complete with possibly HTML tags, etc. The
program then parses the body and extracts all of the HTML tags, along with
some information from the e-mail header.

The program opens the text file, puts each line into a separate cell in
column 1 on a worksheet, without any parsing out to additional columns. The
statement that opens the text file is as follows:

Workbooks.OpenText _
Filename:=strPathFileName, _
Origin:=xlWindows, _
StartRow:=1, _
DataType:=xlDelimited, _
TextQualifier:=xlTextQualifierNone, _
ConsecutiveDelimiter:=False, _
Tab:=False, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=False, _
OtherChar:="", _
FieldInfo:=Array(1, xlTextFormat)

Eveything was working fine, until I ran into an HTML e-mail message that did
not contain the following line in the header (bad e-mail generation program
by the spammer?):

MIME-version: 1.0

As it turns out, if this line is missing, then all you see after the macro
runs is a completely blank worksheet with the gridlines turned off! (There
are other combinations of things that produce other results too numerous to
mention here.)

Does anyone know why the OpenText method "analyzes" the content that it is
importing, instead of simply putting each line of data into a separate cell,
as defined by the delimiter parameters (Tab, Semicolon, Comma, etc.)?

I am using Excel 2000, SP-3 on a Windows ME platform.
--
Regards,
Bill


0 new messages