I am currently working on a task and that is just simply importing a text file into excel via VBA.
The problem is that i would like to write a VBA code which convert the variable "Number" as text format only and no change for the others variables when importing the text file, and therefore, the first digit "0" would be remained after importing into excel.
Below is the example, but the text file actually contains more than 100 variables, recording Macro seems not working for that many variables.
The text file:
DataDate|Model|Status|Status Timestamp |Number |xxx
2021-02-02|Investor|Approved|2020-09-25 15:54:58|0312475|asdfasfsdf
2021-02-02|Investor|Approved|2020-04-23 23:01:30|0312475|asdfasfsdf
2021-02-02|Medium|Approved|2020-09-28 16:49:48|0312475|asdfasfsdf
Please kindly have a look and advise. Many Thanks.
As i would like to have the code which importing a text file with more than 100 variables but only converting the variable "Number" as text. Thanks.
Workbooks.OpenText Filename:=fdata & intxt1, _
Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, _
Other:=True, OtherChar:="|", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 2), Array(6, 1)),
TrailingMinusNumbers:=True, _
Local:=True