View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Keith[_2_] John Keith[_2_] is offline
external usenet poster
 
Posts: 175
Default Workbooks.OpenText dropping last char from input

I have added Column indicators showing where array field goes:

Workbooks.OpenText Filename:="C:\FSOTest\CAFTMAST.txt", Origin:=437, _
StartRow:=2, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(1, xlSkipColumn), _
A,B Array(178, xlGeneralFormat), Array(179, xlGeneralFormat), _
C,D Array(181, xlGeneralFormat), Array(186, xlGeneralFormat), _
E,F Array(189, xlGeneralFormat), Array(196, xlGeneralFormat), _
G,H Array(243, xlGeneralFormat), Array(245, xlGeneralFormat), _
I,J Array(247, xlGeneralFormat), Array(248, xlGeneralFormat), _
Array(255, xlSkipColumn), Array(262, xlSkipColumn), _
K,L Array(269, xlGeneralFormat), Array(277, xlGeneralFormat), _
M,N Array(278, xlGeneralFormat), Array(290, xlGeneralFormat), _
O,P Array(303, xlYMDFormat), Array(311, xlGeneralFormat), _
Q,R Array(312, xlGeneralFormat), Array(313, xlGeneralFormat), _
S Array(323, xlGeneralFormat), _
T Array(327, xlGeneralFormat), _
U Array(329, xlGeneralFormat)), _
TrailingMinusNumbers:=True

This code parses my txt file into columns A-V (the problem is that the
specified array fields should only go to column U. The last 4 bytes of the
file from 329-332 really is 2 fields of 3bytes then 1byte. Most of my input
lines do not contain these last 4 bytes so a <CR is sending the input
pointer to the next record (as it should). With the Array-set-up-lines
shown above. My last 2 columns U and V contain 2 and 2 bytes respectively.
it SHOULD have only U with 4 bytes. ???? (in this case the very last byte
truely IS the last byte on the records that have a value.)
Why does the last array-field get chopped into 2 columns?

When I try to put the correct definition of Array(332, xlGeneralFormat) as
the last field. The last char just disappears completely. It almost seems
like the last position is not allowed to be 1 byte. Can anyone confirm?

I'm about to have to write a code segment that will read in the last column
V and look for the "X" flag that is supposed to be there and when it is some
digit or a digit and an "X", I will have to append the digit to the end of
the digits in col U, leaving just the "X" in col U. Sure seems like a
wishy-washy solution.

--
Regards,
John