S
Saucer Man
I have a macro which automatically imports the contents of a .csv file. The
data which is imported into Coulmn A is a date but it is not in the format
that we want. When it is imported, it looks like this...
20081223155307
We want it to look like this...
12/23/08
We currently have the column format set as Numeric without decimal places.
Can we set the column to a Date format and then have the macro automatically
truncate and convert the imported data to the format we want?
Here is my macro which does the import...
With
ActiveSheet.QueryTables.Add(Connection:="TEXT;c:\UPS_CSV_EXPORT.csv",Destination:=rDest)
.Name = "UPS_CSV_EXPORT"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
data which is imported into Coulmn A is a date but it is not in the format
that we want. When it is imported, it looks like this...
20081223155307
We want it to look like this...
12/23/08
We currently have the column format set as Numeric without decimal places.
Can we set the column to a Date format and then have the macro automatically
truncate and convert the imported data to the format we want?
Here is my macro which does the import...
With
ActiveSheet.QueryTables.Add(Connection:="TEXT;c:\UPS_CSV_EXPORT.csv",Destination:=rDest)
.Name = "UPS_CSV_EXPORT"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With