MATLAB Answers

Deleting pictures from Excel: Shapes.Item.Delete doesn't work

1 view (last 30 days)
AR
AR on 1 Aug 2018
Edited: Walter Roberson on 13 Aug 2018
I have an Excel sheet (assume sheet 5) with several images in it. That is to say .jpg or .png. I do this:
... blah blah...
sheethandle = get(Sheets, 'Item', 5);
invoke(sheethandle, 'Activate');
Activesheet = Excel.Activesheet;
Shapes = sheethandle.Shapes;
for s = Shapes.Count:-1:1
Shapes.Item(s).Delete;
end
At this point, the Shapes variable shows a count of 0 when examined in the workspace. However, the Excel sheet still shows all the images intact. What do I need to do to make it work?

  0 Comments

Sign in to comment.

Answers (1)

Othmane ELMOUATAMID
Othmane ELMOUATAMID on 13 Aug 2018
Edited: Othmane ELMOUATAMID on 13 Aug 2018
Hi AR,
Check this answer.

  1 Comment

AR
AR on 13 Aug 2018
I have seen this answer before. As far as I can tell, this is exactly what I am doing (reported above), but isn't exactly working. Thanks.

Sign in to comment.

Sign in to answer this question.


Translated by