Loosing Leading Zeros While opening a deliminated file that contains Number Columns
Dim sPath As String
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
sPath = "C:\File.dat"
Call xlApp.Workbooks.OpenText(sPath, , , 1, , , , , True, , True, "|")
With above mentioned code, I am trying to open a deliminated file (that contains number columns with leading Zeros). When file is opened in excel, all the leading Zeros are gone.
How can I tell excel not to do any formatting on values (or in other words) keep leading zeros as is.
Thanks
Re: Loosing Leading Zeros While opening a deliminated file that contains Number Colum
Numbers should typically be imported as numeric values and then formatted using the cell format property. If the number of leading zeros varies and has meaning, you can import the column as text by setting the "FieldInfo" parameter of the OpenText method. In the VBA Editor, press F1 for help and search for "OpenText".