This is odd. My VBA imports the file OK but the very long fields spill over and overwrite all subsequent columns on that row with blanks:
If I go the UI Data-From Text/CSV route then the data imports fine with no spilling. The recorded Macro however isn't that useful.
I don't see any way of uploading my test file, it's only 2 rows and 270KB
This is after going the manual route, all the columns appear normally:
and this is using the VBA above, you can see that E1 (~107k characters) and D2 (~53k characters) have overwritten everything in the columns after.
I tried to skip the fields in the VBA by using the below on my real file. The columns are skipped but the data is still missing, I think it must be importing then deleting.
Does anyone have an idea how to get the VBA working properly with these long fields?
Thanks...Buzz
VBA Code:
ReDim ColumnsType(16383)
For i = 0 To 16383
ColumnsType(i) = 2
Next i
With wbNew.ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileToOpen, Destination:=wbNew.ActiveSheet.Range("A1"))
.PreserveFormatting = True
.RefreshStyle = xlOverwriteCells
.AdjustColumnWidth = True
.TextFileParseType = xlDelimited
.TextFilePlatform = Encoding
.TextFileTabDelimiter = True
.TextFileCommaDelimiter = False
.TextFileColumnDataTypes = ColumnsType
.Refresh BackgroundQuery:=False
End With
If I go the UI Data-From Text/CSV route then the data imports fine with no spilling. The recorded Macro however isn't that useful.
I don't see any way of uploading my test file, it's only 2 rows and 270KB
This is after going the manual route, all the columns appear normally:
and this is using the VBA above, you can see that E1 (~107k characters) and D2 (~53k characters) have overwritten everything in the columns after.
I tried to skip the fields in the VBA by using the below on my real file. The columns are skipped but the data is still missing, I think it must be importing then deleting.
VBA Code:
.TextFileColumnDataTypes = Array(2, 9, 9, 9, 2......)
Does anyone have an idea how to get the VBA working properly with these long fields?
Thanks...Buzz