Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Workbooks.OpenText dropping last char from input

Interesting note:
I just found one row in my data that the last 4 bytes are "027X" and the
parsing into col U and V was correct; 027 in col U and X in col V

Most of the rows have just 027_ (for example; _ = space, or actually inplace
of the space, there is a <CR) in the last 4 bytes. In these cases, "2"
shows in col U and "7" shows in col V

But there should not even be a Col V the way the current code is set up.
--
Regards,
John

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
Workbooks.OpenText StartRow:=2 Not Skipping Row 1 John Saunders Excel Programming 2 August 26th 05 11:51 AM
Workbooks.OpenText does not work on XP. HELP !!! [email protected] Excel Programming 6 May 31st 05 03:18 PM
How to open UTF-8 files with Workbooks.OpenText Mete Kural Excel Programming 0 May 7th 05 01:25 AM
Workbooks.OpenText Alistair Eberst Excel Programming 2 October 21st 03 12:50 PM
Using Workbooks.OpenText to read a tab-delimited file into a worksheet Dan E[_2_] Excel Programming 0 August 19th 03 08:02 PM


All times are GMT +1. The time now is 12:01 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"