View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Lonnie M. Lonnie M. is offline
external usenet poster
 
Posts: 184
Default Comma Delimited Text File Issue

Hi, here is an example of some code that imports a text file with 7
columns. You can change the data type to text for your date column and
it should keep your format. This doesn't bring up the wizard, so let me
know if you want a different example to bring up the wizard.

'################################################# #######
' The Array(X,Y) in field info represents that column's data type
''X' Represents the Column; 'Y' Represents the data type
' Data type values:
'1 = General; 2 = Text; 3 = Date (MMDDYY)
Workbooks.OpenText FileName:=Fname, Origin _
:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False
_
, Comma:=False, Space:=False, Other:=False, OtherChar:=False, 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.