procedure TForm1.ButtonClick(Sender: TObject);
var
excel, xlShape : variant;
begin
olecontainer1.CreateObject('Excel.Application',false);
excel := olecontainer1.OleObject;
excel.workbooks.open('C:\test.xls');
XlShape:=excel.ActiveSheet.Shapes.Item(1);// or like this .Item('Rectangle 1');
if VarIsEmpty(xlShape) then
begin
XlShape := excel.application.worksheets[1].Shapes.AddShape(1, 0, 0, 450, 200);
XlShape.textframe.characters.text:='new shape created from Delphi';
//复选框 ControlFormat.value
end
else
ShowMessage(XlShape.textframe.characters.text);
excel.activeworkbook.close;
xlShape:=Unassigned;
excel:=Unassigned;
OleContainer1.DestroyObject;
end;