Tom,
Thanks for the info, its working great so far. I would like to make it
accept a dynamic file name. Here is the code.
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;p:\My Documents\Clients\Campus Partners\020406.txt",
Destination:=Range _
("A1"))
.Name = "020406"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 2, 2, 2, 2, 1, 1, 1, 2, 1,
1, 2, 1, 1, 2, 2, 2, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1 _
, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(1, 5, 30, 9, 25, 25, 25, 18,
9, 1, 1, 10, 10, 9, 5, 9, 2 _
, 2, 1, 2, 1, 1, 10, 10, 10, 6, 10, 10, 10, 7, 1, 7, 7, 7, 7,
3, 3, 3, 3, 3, 3, 10, 1, 7, 1, 1, 6, 10, 10, 10, 10 _
, 5, 5, 1, 5, 5, 10, 10, 10, 10, 10, 7, 10, 7, 1, 1, 1, 2, 3,
30, 25, 25, 25, 18, 9, 1, 1, 10)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Thanks