formatting a column in excel sheet with VB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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/190

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 A

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
 
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").NumberFormat
= "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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top