Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a text file I open up in excel. One of the columns has numbers
with leading zeros. I change the format to text and I save it as a csv file. Then when I import the file into another program the zeros are gone. I also have some numbers like(65110231147009) and when I import the file into another program, they end up like (6.51E+13) which turns the number into (65100000000000). I also reopened the spreadsheet after saving it and they are not correct. Is this because I am saving the spreadsheet as a csv? If so how can I keep the data correct? I have to use csv or xml to import the data into another program. I am using excel 97. TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Create your CSV file using the old method Sub CreateCSV() Dim strLine As String Dim FileNum As Integer Dim cl As Range Dim i As Byte FileNum = FreeFile Open "C:\Yourpath\MyCsvFile.csv" For Output As #FileNum For Each cl In Range("A1", Range("A1").End(xlDown)) i = 1 strLine = cl.Value Do While IsEmpty(cl.Offset(, i)) = False strLine = strLine & ", " & cl.Offset(, i) 'format your cell value here as applicable i = i + 1 Loop Print #FileNum, strLine Next cl Close #FileNum MsgBox "C:\Yourpath\MyCsvFile.csv created !", vbInformation, "Export done" End Sub Regards Jean-Yves "gh" wrote in message ... I have a text file I open up in excel. One of the columns has numbers with leading zeros. I change the format to text and I save it as a csv file. Then when I import the file into another program the zeros are gone. I also have some numbers like(65110231147009) and when I import the file into another program, they end up like (6.51E+13) which turns the number into (65100000000000). I also reopened the spreadsheet after saving it and they are not correct. Is this because I am saving the spreadsheet as a csv? If so how can I keep the data correct? I have to use csv or xml to import the data into another program. I am using excel 97. TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|