I would like to programatically add a shape into the current slide of PowerPoint in C# .NET
So, I have created a VSTO Add-in with a ribbon which has a button "Add Shape". When this button is clicked, the following code executes:
Globals.ThisAddIn.Application.ActiveWindow.View.Slide.Shapes.AddShape(
Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0, 10, 20);
When this code executes, it correctly adds a rectangle shape into the current slide.
I would like to modify this shape later (for example; change it's width). To be able to do this, I read somewhere that the shape should have a unique identifier and this can be achieved using a Tag
?
If so, how do you add a shape and set a tag on the newly added shape, so that I can manipulate it later?
Also, how do you iterate through the collection of shapes on the current slide, so that you can check the tag of the shape to see if that's the one I want to modify?