|
|||||||
FieldInfo Array(Array())
Время создания: 16.03.2019 23:43
Раздел: Разные закладки - VBA - Excel
Запись: xintrea/mytetra_db_adgaver_new/master/base/1486993022gm7iwcdif1/text.html на raw.githubusercontent.com
|
|||||||
|
|||||||
'///////////////////////////////////////////////////////////////// http://www.cyberforum.ru/vba/thread492144.html '///////////////////////////////////////////////////////////////// Dim varArray(1 To 16384) As Variant For i = 1 To 16384 ''Max number of columns as of excel 2007 varArray(i) = Array(i, 2) Next i Workbooks.OpenText Filename:=sFileName, _ DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, Comma:=True, _ FieldInfo:=varArray '///////////////////////////////////////////////////////////////// FieldInfo - просто 2-размерный массив. Прилагаю что я когда-то записал в свою записную книжку *OPenText NOtes *expression.OpenText(Filename, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo), *where only one parameter requered, Filename
* www.universalthread.com, Message# 702641
oExcel.Workbooks.OpenText(lcSemiColonFile,,,xlDelimited,,,,.T.,,,,, @arrFldSemicolonInfo) *If you know the format of fields create an array defining it, * otherwisee do not pass field info array. oExcel.Workbooks.OpenText(lcSemiColonFile,,,xlDelimited,,,,.T.)
*Field info array is two dimensional where first defines the column order and second formatting. ie: *If you would export 10 columns where 5,6th columns are date type and you want them as MDY (rest text):
*#DEFINE xlDelimited 1 *#DEFINE xlFixedWidth 2
*#DEFINE xlGeneralFormat 1 *#DEFINE xlTextFormat 2 *#DEFINE xlMDYFormat 3 *#DEFINE xlDMYFormat 4 *#DEFINE xlYMDFormat 5 *#DEFINE xlMYDFormat 6 *#DEFINE xlDYMFormat 7 *#DEFINE xlYDMFormat 8 *#DEFINE xlSkipColumn 9 *#DEFINE xlEMDFormat 10
dimension arrFldSemicolonInfo[10,2] for ix=1 to 10 arrFldSemicolonInfo[ix,1]=ix arrFldSemicolonInfo[ix,2]=xlTextFormat endfor arrFldSemicolonInfo[5,2]=xlMDYFormat arrFldSemicolonInfo[6,2]=xlMDYFormat |
|||||||
Так же в этом разделе:
|
|||||||
|
|||||||
|