FieldInfo

  • Thread starter Sören_Marodören
  • Start date
S

Sören_Marodören

I'm looking for information about the parameter FieldInfo that is used below:

Workbooks.OpenText Filename:=HelaFilNamn(i), _
Origin:=xlMSDOS, StartRow:=1, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, _
Other:=False, DecimalSeparator:=",", _
FieldInfo:=Array(1, 1), _
TrailingMinusNumbers:=True

What is it used for?
Can you use something else then arrays?
Do I need it?
When do I need it?

Best regards,
/Sören
 
O

OssieMac

Look up Help from the VBA Editor. (Ensure you are in the VBA editor not a
worksheet because they are two different help files).

Enter 'opentext filename' for the search and you will see a list of all the
parameters or arguments and descriptions.

Text files often need the data to be separated into columns and if opened
manually, you do this with 'Text to Columns'. When doing this you can set the
data type of various columns as dates etc and the array holds the column
number and the data type of the column.

How many and which arguments you need depends on the text being imported.

Regards,

OssieMac
 
J

Joel

Below came from the VBA help menu. This is strange because whatt you see in
the help menu and whatt you see after yo paste the help is completely
different. Performing a copy and paste on help items gives more
informattion?????


FieldInfo Optional xlColumnDataType. An array containing parse information
for individual columns of data. The interpretation depends on the value of
DataType. When the data is delimited, this argument is an array of
two-element arrays, with each two-element array specifying the conversion
options for a particular column. The first element is the column number
(1-based), and the second element is one of the XlColumnDataType constants
specifying how the column is parsed.

XlColumnDataType can be one of these XlColumnDataType constants.
xlGeneralFormat General
xlTextFormat Text
xlMDYFormat MDY date

xlDMYFormat DMY date

xlYMDFormat YMD date

xlMYDFormat MYD date

xlDYMFormat DYM date

xlYDMFormat YDM date

xlEMDFormat EMD date

xlSkipColumn Skip Column


You can use xlEMDFormat only if you have installed and selected Taiwanese
language support. The xlEMDFormat constant specifies that Taiwanese era dates
are being used.

The column specifiers can be in any order. If there's no column specifier
for a particular column in the input data, the column is parsed with the
General setting.

Notes

If you specify that a column is to be skipped, you must explicitly state the
type for all remaining columns or the data will not parse correctly.
If there is a recognizible date in the data, the cell will be formatted as a
date in the worksheet even if the setting for the column is General.
Additionally, if you specify one of the above date formats for a column and
the data does not contain a recognized date, then the cell format in the
worksheet will be General.
This example causes the third column to be parsed as MDY (for example,
01/10/1970), the first column to be parsed as text, and the remaining columns
in the source data to be parsed with the General setting.

Array(Array(3, 3), Array(1, 2))

If the source data has fixed-width columns, the first element in each
two-element array specifies the position of the starting character in the
column (as an integer; character 0 (zero) is the first character). The second
element in the two-element array specifies the parse option for the column as
a number between 0 and 9, as listed in the preceding table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top