Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Delphi 3: Changing Excel Cell-Format to Date/Time with OLE

1,187 views
Skip to first unread message

Dino Ciotola

unread,
May 6, 1998, 3:00:00 AM5/6/98
to

Hi !

I'm just making my first steps with OLE and I encountered the following
problem:

Using Delphi 3 and OLE, I filled an Excel97 sheet with data. Now I would
like to change the format of some columns to 'Date' or 'Time', but I
didn't find any Helpfile, solving that problem.
But I'm quite sure: It can't be so difficult !!!

Has anyone an idea ???

David Bergquist

unread,
May 11, 1998, 3:00:00 AM5/11/98
to

Dino,

After you have attached to Excel and selected the target cells, try the
following,

ExcelApp.Selection.NumberFormat := 'm/d/yy';

where ExcelApp : OLEVariant; is assigned to the Excel application object.

Good Luck.
Dave Bergquist

Dino Ciotola <cio...@msmhdg.hoechst.com> wrote in article
<355075...@msmhdg.hoechst.com>...

Gary Calvin

unread,
May 20, 1998, 3:00:00 AM5/20/98
to cio...@msmhdg.hoechst.com

I've been playing with this the last few days, and here's how I find the
syntax for what I want to do:

1) Open Excel
2) Do Tools | Macro | Record New Macro...
3) Do whatever it is I want to automate (select column, right-click, Format
| Date, etc)
4) Stop the macro recorder
5) Do Tools | Macro | Macros...
6) Select the macro I just recorded and click Edit

This usually shows me exactly what I need, and if I need more info at that
point, I'll look at the Excel Help.

0 new messages