Sub aaa()
Dim OutSH As Worksheet
Sheets("Home").Select
File2 = Application.GetOpenFilename("Text Files (*.txt), *.txt", , "Select the file to import")
If File2 = "false" Then Exit Sub
Sheets.Add before:=Sheets(1)
ActiveSheet.Name = Sheets("Home").Range("A1").Value
Set OutSH = ActiveSheet
Range("A1:D1").Value = Array("Date", "Time", "Setpoint 1", "Setpoint 2")
Range("E1").Value = Sheets("Home").Range("B5").Value
Range("F1").Value = Sheets("Home").Range("D5").Value
Workbooks.OpenText Filename:=File2, Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), _
Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15, 1), Array( _
16, 1), Array(17, 1), Array(18, 1), Array(19, 1), Array(20, 1), Array(21, 1), Array(22, 1), _
Array(23, 1), Array(24, 1), Array(25, 1), Array(26, 1), Array(27, 1), Array(28, 1), Array( _
29, 1), Array(30, 1), Array(31, 1), Array(32, 1), Array(33, 1), Array(34, 1), Array(35, 1), _
Array(36, 1), Array(37, 1), Array(38, 1), Array(39, 1), Array(40, 1), Array(41, 1), Array( _
42, 1), Array(43, 1), Array(44, 1), Array(45, 1), Array(46, 1), Array(47, 1), Array(48, 1), _
Array(49, 1), Array(50, 1), Array(51, 1), Array(52, 1), Array(53, 1), Array(54, 1), Array( _
55, 1), Array(56, 1), Array(57, 1), Array(58, 1), Array(59, 1), Array(60, 1), Array(61, 1), _
Array(62, 1), Array(63, 1), Array(64, 1), Array(65, 1), Array(66, 1), Array(67, 1), Array( _
68, 1), Array(69, 1), Array(70, 1), Array(71, 1), Array(72, 1), Array(73, 1)), _
TrailingMinusNumbers:=True
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
lastcol = Cells(3, Columns.Count).End(xlToLeft).Column
Range(Range("A3"), Cells(lastrow, lastcol)).AdvancedFilter Action:=xlFilterCopy, copytorange:=OutSH.Range("A1:F1")
ActiveWorkbook.Close savechanges:=False
End Sub
You will have to update it for the extra columns that you want as I don't have access to the real headings, but hopefully you will get what I'm trying to do. It does open the file completely in Excel, but then shuts it down again. If you turn off the display, then it really shouldn't be a problem.
Bookmarks