Andre Hass
Posts: 3
Joined: 2007-09-11
|
hi,
i tried to set the OnAction-Property to an ShapeObject by an ADX COM Add-In.
...
if Length(pictFile) > 0 then
begin
Shw := Sheet.Shapes.AddPicture(pictFile, TOleEnum(False), TOleEnum(True), l, t, w, h);
Shw.Name := pictName;
Shw.OnAction := 'OnClick';
end;
Result := pictName;
end;
So far, so good, but if I click on this Shape-Object in Excel, this Function is not executed!
procedure TQRFuncs.OnClick();
var
dispShape: MyShape;
dispShapeRange: MyShapeRange;
V: OleVariant;
begin
try
try
V := OleVariant(Instance.ExcelApp.Selection[adxLCID]).ShapeRange;
dispShapeRange := MyShapeRange(TVarData(V).VDispatch);
if Assigned(dispShapeRange) then
begin
dispShape := dispShapeRange.Item(1);
dispShape.TopLeftCell.Select;
end;
finally
dispShape := nil;
dispShapeRange := nil;
V := Unassigned;
end;
except
end;
end;
What went wrong? Is it possible to handle this event in this way?
Thanks in advanced! |
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Andre,
---
OnAction property:
Returns or sets the name of a macro that?Â?Ð?és run when the specified object is clicked.
---
You can try to use the OnSheetSelectionChange or OnSheetChange events.
|
|
Andre Hass
Posts: 3
Joined: 2007-09-11
|
I also feared thats the reason for. Thanks Dmitry! |
|