chipsworld
Board Regular
- Joined
- May 23, 2019
- Messages
- 169
- Office Version
- 365
OK...I have some code that imports a csv into a sheet, but I don't want ALL of the data...
I need to be able to skip certain "fields" in the line string from the CSV. How can I accomplish that with the below?
I need to be able to skip certain "fields" in the line string from the CSV. How can I accomplish that with the below?
VBA Code:
Sub ImportCSV(customerfilename, unitnam, targetSheet)
Dim rw As String
With ThisWorkbook.Sheets("Template").QueryTables.Add(Connection:= _
"TEXT;" & customerfilename, Destination:=ThisWorkbook.Sheets("Template").Range("$C$2"))
.Name = "unitnam"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.TextFilePromptOnRefresh = False
.TextFilePlatform = 65001
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.Refresh BackgroundQuery:=False
'.Delete BackgroundQuery:=True
'.UseListObject = False
End With
end sub