sajjaddaya
New Member
- Joined
- Oct 26, 2011
- Messages
- 14
Hi Guys,
I have managed to come up with the following macro. The problem I have is that some of the data are imported in text format, while other data are imported in general format.
I have a large data set, with more then 5,000 rows, and 2,000 columns, and I would like ALL the data imported at text. How can I modify this macro to make that happen?
Thanks in advance for all your help!
Sajjad
I have managed to come up with the following macro. The problem I have is that some of the data are imported in text format, while other data are imported in general format.
I have a large data set, with more then 5,000 rows, and 2,000 columns, and I would like ALL the data imported at text. How can I modify this macro to make that happen?
Code:
Sub ImportData()
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Users\*****\ATTRIBUTES-ModifiedExport.csv", Destination:=Range("$A$1"))
.Name = "ATTRIBUTES-ModifiedExport.csv"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileOtherDelimiter = "|"
.TextFileColumnDataTypes = _
Array(xlTextFormat)
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Thanks in advance for all your help!
Sajjad