Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to import file (help with a piece of code)
I actually use a macro to import a txt file with a lot of columns
Below there is a part of the code that allows me to import the file... I want to import only the first 6 columns (from A to g) and actually I import all the columns and then erase the exceeding with Columns("G:IV").Select Selection.Delete Shift:=xlToLeft How can I import them without doing the delete procedure...? I think there is sthg to do with .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1) But I don't understand what.... With ActiveSheet.QueryTables.Add(Connection:=fileToOpen _ , Destination:=Range("A1")) .Name = "Push" .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 = 3 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierNone .TextFileConsecutiveDelimiter = True .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = True .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False Columns("G:IV").Select Selection.Delete Shift:=xlToLeft |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Interpretation of a piece of code | Excel Discussion (Misc queries) | |||
What is wrong with this vba piece of code? | Excel Discussion (Misc queries) | |||
VB Code or Excel macro to run Query/Import on Access file | Excel Programming | |||
changing a piece of code | Excel Programming | |||
Query on small piece of code | Excel Programming |