Setting Excel cell format

  • Thread starter Thread starter Sasha
  • Start date Start date
S

Sasha

I need to export data to an excel file programmatically. Date includes time
in form of min:sec and full date with time. IRange::PutValue2 accepts variant
and if I pass COleVaraint created from COleDateTime I have excel show value
as a double "39726.47661". I need to manually right click and select "Format
Cells..." menu, then select Date or time Category and then the value is shown
as I want. How can I do all this programmatically so that value is shown as
date and time initially?
 
This is the way Excel internally stores dates. You need to
1. Set the format in your import program if you can or
2. Have a macro to do that or
3. Convert the dates before importing to the format you want but then they
will be treated as text and not dates in Excel.
 

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