342 shaares
45 liens privés
45 liens privés
1 résultat
taggé
vba
Excel can be rather particular about what it accepts as "valid CSV". I had to resort to the following on several occasions:
Const vbFormatStandard = 1
Const vbFormatText = 2
Const vbFormatDate = 4
Const xlDelimited = 1
Const xlDoubleQuote = 1
' change according to number/type of the fields in your CSV
dataTypes = Array( Array(1, vbFormatText)
, Array(2, vbFormatStandard)
, Array(3, vbFormatText)
, Array(4, vbFormatDate)
)
Set xl = CreateObject("Excel.Application")
xl.Visible = True
xl.Workbooks.OpenText "input.csv", , , xlDelimited, xlDoubleQuote, False _
, False, True, , , , dataTypes
Set wb = xl.ActiveWorkbook