I am using VBA to open a csv file and split it to columns by using commando TextToColumns. After running the macro the hext has been split to columns but some values have been changed to dates, for example values starting with 07-5... When I do the same thing in Excel without using VBA those values are not changed. To make the conversion to columns I use below code and it is the same code that changes some of the values to dates.
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1)), TrailingMinusNumbers:=True
I have tried to change number format to '@' and '0' before and after the TextToColumns commando with no success. Can you please tell me how to solve this problem?
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1)), TrailingMinusNumbers:=True
I have tried to change number format to '@' and '0' before and after the TextToColumns commando with no success. Can you please tell me how to solve this problem?