View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GJones GJones is offline
external usenet poster
 
Posts: 132
Default formatting a column in excel sheet with VB

Hi Chris;

Try this:

Columns("A:A").NumberFormat = "m/d/yy h:mm AM/PM"
Where the column is A.

If you are using an automation object your code might look
like this:

MyAutomationObject.Application.Columns("A:A").Numb erFormat
= "m/d/yy h:mm AM/PM"



-----Original Message-----
Hi,

I have a Visual Basic 5.0 application that opens a

recordset and then sends the output to an excel
spreadsheet.

One of the fields in my recordset is a date/time datatype

of short time.

When the excel object is created and I see the sheet

appear the column for the this field looks like this:

1/0/1900

If i click into a cell in this column and look at the

cell contents i see the correct full date time.
which is example: 04/19/04 6:30 AM

How do I format this column in my visual basic

application using the excel object to show the short time
once the excel sheet is created and visible?

I'm new to the excel sheet object model.

advice would be appreciated.

thanks
.