+ Reply to Thread
Results 1 to 4 of 4

Import text file FieldInfo:=Array

Hybrid View

  1. #1
    Greg
    Guest

    Re: Import text file FieldInfo:=Array

    > > "FieldInfo:=Array(Array(1, 2), Array(2, 2)...." And to make the
    > > FieldInfo:=Array convert the information to TEXT instread of general?


    >
    > If you want to import all the columns, but only specifically format a few of
    > them, you can do that to. Any columns you don't specify will be imported as
    > general. If you want a column as something other than general, you have to
    > identify it. The columns can be identified in any order.
    >
    > To make column 4 text: Array(4, xlTextFormat)


    **** to clarify, if I want all the columns text then I would use
    FieldInfo:=Array(Array(1, xlTextFormat), Array(2, xlTextFormat)....

  2. #2
    Dave Peterson
    Guest

    Re: Import text file FieldInfo:=Array

    And if you know all the fields are Text, you can build an array that fieldinfo
    can use:

    ''''more of your other code...
    Dim myArray() As Variant
    Dim iCtr As Long
    Dim maxFields As Long

    maxFields = 256 '256 columns maximum

    ReDim myArray(1 To maxFields, 1 To 2)
    For iCtr = 1 To 256
    myArray(iCtr, 1) = iCtr
    myArray(iCtr, 2) = 2
    Next iCtr

    Workbooks.OpenText Filename:=Fname, Origin:=437, _
    StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
    ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
    , Space:=False, Other:=False, FieldInfo:=myArray, _
    TrailingMinusNumbers:=True


    Greg wrote:
    >
    > > > "FieldInfo:=Array(Array(1, 2), Array(2, 2)...." And to make the
    > > > FieldInfo:=Array convert the information to TEXT instread of general?

    >
    > >
    > > If you want to import all the columns, but only specifically format a few of
    > > them, you can do that to. Any columns you don't specify will be imported as
    > > general. If you want a column as something other than general, you have to
    > > identify it. The columns can be identified in any order.
    > >
    > > To make column 4 text: Array(4, xlTextFormat)

    >
    > **** to clarify, if I want all the columns text then I would use
    > FieldInfo:=Array(Array(1, xlTextFormat), Array(2, xlTextFormat)....


    --

    Dave Peterson

+ 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