View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Belinda Belinda is offline
external usenet poster
 
Posts: 23
Default How to read from a SQL Server table into Excel and use the Excel cell format as in the database

Hello All

I am reading data from a SQL Server table using ADO and as I read the
recordset I place each recordset field into a Excel cell. But
sometimes when I read a field in the SQL Server which is of type
nvarchar the data in the SQL table is
as follows:

000003710
000003720

but in Excel this is displayed by my ADO read program with the leading
zeros chopped as follows:

3710
3720

how can I set the Excel cell format programmatically based on the data
type of the SQL table field please advise.

Thanks
Belinda