Sub Import_Stats_Breakdown() ' ' Import_Stats_Breakdown Macro ' ' Sheets("Breakdown Contacts").Select Range("A2").Select With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;Seatrade Shared:DATABASE (NEW):Contact Extract - Breakdown", Destination:=Range("A2")) .Name = "Contact Extract - Breakdown" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .TextFilePromptOnRefresh = False .TextFilePlatform = xlMacintosh .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(2, 2, 2) .Refresh BackgroundQuery:=False .UseListObject = False End With Range("A2").Select End Sub
Now, what I want to be able to do is tell it to import a file based on a filename entered in say, cell C3, so I need to change the 'With...' line to something, and also the '.Name...' line I guess.
Can anyone help? There are some positive thoughts in it for you.