Re: Excel spreadsheets & Delphi



On Mon, 22 Oct 2007 17:14:46 +0100, "Frank Stacey"
<f._spamremove_stacey@xxxxxxxxx> wrote:


"Andreas Koch" <nospam@xxxxxxxxxxxxxxx> wrote in message news:ffhush$jgr$00$1@xxxxxxxxxxxxxxxxxxxx
Frank Stacey wrote:
I have been using Delphi 7 for several years. By using I mean writing a number of toy programs to do things that are
useful to me. I would now like to write a program whose data is defined in an Excel spread*** (possibly workbook).

Is it possible to import spread*** data directly into a Delphi environment? Can anyone give me any idea where to
start looking for information?

Its not clear to me what you need exactly. Do you just need to access
numbers written to an Excel spread*** from your Delphi application?
Or do you want to convert an Excel application with VBA macros and
formulas to an Delphi application?

Look for a component tab named "Server", which should have some
office related components (TExcelapplication etc)





The former. I want to get at the cells and use the data to do some caculation then put the results back into the same
spread***. The caculation could be done using VBA, I am sure, but then I would suffer the delay of familiarising
myself with the Excel/VBA environment. I have done a little VBA programming within Access but even less than the amount
of Delphi but I am very much at home in Delphi.

I will look for the server stuff.
Thanks
Frank

Hi Frank,

It should be very easy to do the kind of stuff you asked about using
Excel's VBA.

Just record a macro that does a simplified example of what you want to
accomplish then look at the VBA code that's generated. It should be
pretty easy to grasp and modify for your purpose.

If your calculation needs multiple steps, you can record example
macro's of each step to see how it's done. Then build your app from
the knowledge you gain from looking at the recorder generated code.

I'm not putting Delphi down.It just seems that it makes more sense to
use Excel's internal capabilities for the kind of thing you're asking
about. Because you're manipulating Excel objects the Delphi code will
be very similar to the VBA code but will add an extra, unnecessary,
external layer of complexity.

Try recording a macro, it should be easy. Ask me if you get stuck.

Good luck,

Don

.


Quantcast