Answered by:
How to subtract a shape from another shape

Question
-
How a shape can be subtracted from another shape programmatically?
Lateef Sofi
- Moved by Fei XueMicrosoft employee Wednesday, December 9, 2015 5:42 AM PowerPoint specific issue
Tuesday, December 8, 2015 4:54 PM
Answers
-
Hi Lateef,
Thanks for the detail information for this issue.
Yes, we can use ShapeRange.MergeShapes method to automate this behavior. For example, here is a demo that making subtraction for the two shapes on the first slide.
Dim myShapreRange As ShapeRange Set myShapreRange = ActivePresentation.Slides(1).Shapes.Range(Array(1, 2)) myShapreRange.MergeShapes msoMergeSubtract
We can also refer to the shape via its name instead of the index of shape on the slide.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Fei XueMicrosoft employee Monday, December 21, 2015 9:25 AM
- Marked as answer by Fei XueMicrosoft employee Tuesday, December 22, 2015 8:08 AM
Friday, December 11, 2015 7:23 AM
All replies
-
Hi Lateef,
This forum is for developers for discussing developing issues about Office add-in. Based on the previews post, you were developing the VSTO add-in instead of Office-addin(apps for Office), I would like to move it to General Office Develop forum.
And for the issue mentioned in the title, did you want to edit the shape like figure below?
If I understood correctly, we can use ShapeNodes.Insert to automate this progress. And here is code sample for your reference:
Sub Test() ActivePresentation.Slides(1).Shapes(1).Nodes.Insert 1, msoSegmentCurve, msoEditingSymmetric, 200, 200 End Sub
You can get more detail about this method from link below:
ShapeNodes.Insert Method
If I misunderstood, please feel free to let us know.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Wednesday, December 9, 2015 5:42 AM -
Thanks Fei,
Yes you had misunderstood it.
In powerpoint, if the parts of the two shapes are overlapping, we can select the shapes and subtract them. Suctract will remove the overlapped portion from the shapes. I would like to do this task through code.
Lateef Sofi
Thursday, December 10, 2015 9:54 AM -
Hi Lateef,
Thanks for the detail information for this issue.
Yes, we can use ShapeRange.MergeShapes method to automate this behavior. For example, here is a demo that making subtraction for the two shapes on the first slide.
Dim myShapreRange As ShapeRange Set myShapreRange = ActivePresentation.Slides(1).Shapes.Range(Array(1, 2)) myShapreRange.MergeShapes msoMergeSubtract
We can also refer to the shape via its name instead of the index of shape on the slide.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Fei XueMicrosoft employee Monday, December 21, 2015 9:25 AM
- Marked as answer by Fei XueMicrosoft employee Tuesday, December 22, 2015 8:08 AM
Friday, December 11, 2015 7:23 AM