View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Lonnie M. Lonnie M. is offline
external usenet poster
 
Posts: 184
Default opening a tab delimited text file

Hi, I adapted this from a previuos post. See the comments below to
select the data type for a given column.

' The Array(X,Y) in field info represents that column's data type
' 'X' represents the column
' 'Y' represents the data type
' 1 = General; 2 = Text; 3 = Date (MMDDYY)
Workbooks.OpenText FileName:=Fname, Origin _
:=xlWindows, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False,
Semicolon:=False _
, Comma:=False, Space:=False, Other:=True, OtherChar:="~",
FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 2), Array(4, 2),
Array(5, 1), _
Array(6, 3), Array(7, 3))
Columns.AutoFit

HTH--Lonnie M.