Attribute VB_Name = "Module1" Sub Load_net_file() Attribute Load_net_file.VB_Description = "Macro recorded 09-12-2001 by R.Hughes-Jones" Attribute Load_net_file.VB_ProcData.VB_Invoke_Func = " \n14" ' ' Macro4 Macro ' Macro recorded 09-12-2001 by R.Hughes-Jones ' ' Request name of file to open fileToOpen = Application _ .GetOpenFilename("Text Files (*.txt), *.txt") If fileToOpen <> False Then ' parse filename to make local variables conn_param = "TEXT;" & fileToOpen num = InStrRev(fileToOpen, "\") + 1 Sheet_name = Mid(fileToOpen, num) num = InStr(1, Sheet_name, ".") - 1 Sheet_name = Left(Sheet_name, num) ' clear current contents Cells.Select Selection.Clear ' Selection.QueryTable.Delete Range("A1").Select ' name the sheet ActiveSheet.Name = Sheet_name ' input the text data With ActiveSheet.QueryTables.Add(Connection:= _ conn_param, _ Destination:=Range("A1")) .Name = "sys_gig_udp_31" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = False .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = xlWindows .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = True .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(1) .Refresh BackgroundQuery:=False End With End If End Sub