ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   importing prn file (https://www.excelbanter.com/excel-programming/272253-importing-prn-file.html)

Rosson Cain

importing prn file
 
I recorded the importation of a prn file and the VB code
that came out is below. My question is, does anybody know
where the code specifies what data type each column is
(text, number, date, etc.) any help would be
appreciated. thanks.

Workbooks.OpenText FileName:= _
fileToOpen, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False,
Semicolon:=False, Comma:=True _
, Space:=False, Other:=False, FieldInfo:=Array
(Array(1, 2), Array(2, 1), _
Array(3, 1), Array(4, 2), Array(5, 2), Array(6,
1), Array(7, 1), Array(8, 1), Array(9, 1), _
Array(10, 1), Array(11, 1), Array(12, 1), Array
(13, 1), Array(14, 1), Array(15, 1), Array( _
16, 1))

Rob Bovey

importing prn file
 
Hi Rosson,

Each inner Array() function in the FieldInfo array specifies what to do
with one column of the text file being imported. The first element of the
inner array specifies the starting point of the column and the second
element specifies the data type used to interpret the contents of the
column. 1 = General, 2 = Text, 3 - 8 = Date formats, 9 = Skip column.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Rosson Cain" wrote in message
...
I recorded the importation of a prn file and the VB code
that came out is below. My question is, does anybody know
where the code specifies what data type each column is
(text, number, date, etc.) any help would be
appreciated. thanks.

Workbooks.OpenText FileName:= _
fileToOpen, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False,
Semicolon:=False, Comma:=True _
, Space:=False, Other:=False, FieldInfo:=Array
(Array(1, 2), Array(2, 1), _
Array(3, 1), Array(4, 2), Array(5, 2), Array(6,
1), Array(7, 1), Array(8, 1), Array(9, 1), _
Array(10, 1), Array(11, 1), Array(12, 1), Array
(13, 1), Array(14, 1), Array(15, 1), Array( _
16, 1))





All times are GMT +1. The time now is 12:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com