If you have Excel 2000 or later:
Sub Macro3()
'
' Macro3 Macro
' Macro recorded 12/2/2003 by OGILVTW
'
'
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\D ata\aaa_tab.txt",
_
Destination:=Range("F20"))
.Name = "aaa_tab"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
End Sub
--
Regards,
Tom Ogilvy
"clui" wrote in message
...
What's the VBA code to import a tab delimited text file to a worksheet
in an existing workbook? Thanks!
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/
~~Now Available: Financial Statements.xls, a step by step guide to
creating financial statements