Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm developing a vb .net function that creates a .xls or .csv for a vb .net
dataset. The guts of the routine goes something like this: objws.Cells(rowindex, colindex) = fixedstring When I print fixedstring to the screen, it reads, for example, '00833', but once I save it, it becomes 833 and Excel sees it as a number, not text. I've tried every file format I can think of, but regardless how I save it, I get the same result. Is there something I need to do to preserve prefix '0's and the data type as string rather than numeric? Thanks for any help. Bernie Yaeger |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
objws.Cells(rowindex, colindex).Value = "'" & fixedstring
prefix it with a single quote. -- Regards, Tom Ogilvy "Bernie Yaeger" wrote in message t... I'm developing a vb .net function that creates a .xls or .csv for a vb ..net dataset. The guts of the routine goes something like this: objws.Cells(rowindex, colindex) = fixedstring When I print fixedstring to the screen, it reads, for example, '00833', but once I save it, it becomes 833 and Excel sees it as a number, not text. I've tried every file format I can think of, but regardless how I save it, I get the same result. Is there something I need to do to preserve prefix '0's and the data type as string rather than numeric? Thanks for any help. Bernie Yaeger |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
That did it! Thanks very much. Bernie "Tom Ogilvy" wrote in message ... objws.Cells(rowindex, colindex).Value = "'" & fixedstring prefix it with a single quote. -- Regards, Tom Ogilvy "Bernie Yaeger" wrote in message t... I'm developing a vb .net function that creates a .xls or .csv for a vb .net dataset. The guts of the routine goes something like this: objws.Cells(rowindex, colindex) = fixedstring When I print fixedstring to the screen, it reads, for example, '00833', but once I save it, it becomes 833 and Excel sees it as a number, not text. I've tried every file format I can think of, but regardless how I save it, I get the same result. Is there something I need to do to preserve prefix '0's and the data type as string rather than numeric? Thanks for any help. Bernie Yaeger |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Autofill data based on an assigned code/prefix | Excel Worksheet Functions | |||
zipcode phone # area code/prefix problem | New Users to Excel | |||
Macro code for dropping to next empty cell | Excel Discussion (Misc queries) | |||
spreadsheet dropping leading zeroes when exporting from SQL Serve. | Excel Worksheet Functions |