Try this. It requires your template to be in the same folder as the workbook.
Sub ReadTextFile()
Dim A As Integer, B As Integer, C As Single
Dim iRow As Long
Dim Fname As Variant
Dim shtData As Worksheet
Fname = Application.GetOpenFilename("Text Files (*.txt),*.txt", , _
"Select Text Data File")
If Fname = False Then Exit Sub
Set shtData = Workbooks.Add(Template:=ThisWorkbook.Path & "\InformationTemplate.xltm").Worksheets(1)
With shtData.QueryTables.Add(Connection:="TEXT;" & Fname, Destination:=shtData.Range("A7"))
.Name = Replace(".txt", "", shtData.Name)
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Bookmarks