Posted to microsoft.public.excel.programming
|
|
zero's in excel cell getting rounded off
Reset the number format for the required range to display
"Range".NumberFormat = "000000"
"Nasreen naqvi" wrote:
i am using a VB routine to parse the text file and copy the data to an
excel sheet.and if in text file the data is 000000000 it is getting
rounded to just one 0 and i need all of them in excel, any thoughts?
Private Sub cmdgo_Click()
Set sap_xlapp = CreateObject("Excel.Application") 'New
Excel.Application
sap_xlapp.DisplayAlerts = False
sap_xlapp.Workbooks.Open App.Path & "\SAP_Data.xls", , False, , , ,
True, , , True, False 'the excel file is now opened
sap_xlapp.Worksheets(1).Activate ' the excel worksheet is now active
for reading
Set sap_xlws = sap_xlapp.ActiveSheet
l_int_srow = 1
sap_xlws.Cells(l_int_srow, 1) = "Permanent Number"
sap_xlws.Cells(l_int_srow, 2) = "Name"
l_int_srow = l_int_srow + 1
cmdgo.Enabled = False
Call Main
'Transformation completed so clean up resources
cmdgo.Enabled = True
Set sap_xlws = Nothing
sap_xlapp.ActiveWorkbook.Save
sap_xlapp.ActiveWorkbook.Close
sap_xlapp.Quit
Set sap_xlapp = Nothing
End Sub
as seen in the code the numberic value is getting off which is stored in
variable of string type
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
|