+ Reply to Thread
Results 1 to 2 of 2

Workbooks.OpenText dropping last char from input

  1. #1
    John Keith
    Guest

    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. #2
    John Keith
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1