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

Access combo boxes properties

5 views
Skip to first unread message

Donato Cappiello

unread,
Oct 7, 2004, 6:15:31 AM10/7/04
to
Dear all,

I am trying to access the properties of a combobox in an excel application
using Delphi 7. Using the TExcelWorksheet component (on the Server
components palette) I can access comboboxes and checkboxes inside a sheet in
an Excel application with the following code:

ExcelWorksheet1.Shapes.Item(1).Name

this approach allow me to move the control in the sheet using Delphi code
but it does not allow me to access the property 'LinkedCell' because that
property is not exposed at 'shapes' level. Did you try to do any automation
between Delphi and Excel before? Can you help?

apologies for my bad English

Ciao

Donato

Deborah Pate (TeamB)

unread,
Oct 7, 2004, 8:00:18 AM10/7/04
to
<<Donato Cappiello:

I can access comboboxes and checkboxes inside a sheet in
an Excel application with the following code:

ExcelWorksheet1.Shapes.Item(1).Name
>>

You can access them as OleObjects to get at the LinkedCell
property, e.g.
var
Obj: OleVariant;
..
Obj := WS.OLEObjects('CheckBox1');

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html


Donato Cappiello

unread,
Oct 7, 2004, 10:35:09 AM10/7/04
to
Dear Deborah,

sorry to bother you with my trivial questions but I am new to Automation.
Can you tell me what kind of object is WS. I thought was a Tworksheet server
component and I modified your code in the following ways:

var
Obj: OleVariant;
..
Obj := WS.OLEObjects('CheckBox1');

showmessage(Obj.LinkedCell);

in this case an empty message is shown even if the LinkedCell of the
CheckBox1 has been assigned.

var
Obj: OleVariant;
aFont: OleVariant;


..
Obj := WS.OLEObjects('CheckBox1');

Obj := ExcelWorksheet1.OLEObjects('CheckBox1');
aFont := Obj.Font;

in this case the following message is shown: 'Method Font' not supported
by automation object. It seems that font has been interpreted as a Method
and not as a properties. I am thinking of Excel object like Delphi objects
and I am trying to manipulate them using a Delphi like grammar. This is
obviously wrong. Can you point me in the right direction?

Thank you very much for your help

Ciao

Donato


"Deborah Pate (TeamB)" <d.p...@blueyonder.co.not-this-bit.uk> wrote in
message news:VA.00001f0...@blueyonder.co.not-this-bit.uk...

Donato Cappiello

unread,
Oct 7, 2004, 10:47:31 AM10/7/04
to
Dear Deborah,

I am a muppet. Your code is working fine. I was accessing the wrong
component: 'checkbox1' instead of 'combobox1'. I am an happy man now! :o)

Thank you very much for your help

Ciao

Donato

"Donato Cappiello" <donato.c...@abacusint.com> wrote in message
news:4165...@newsgroups.borland.com...

0 new messages