|
本帖最后由 aman1516 于 2023-8-21 12:40 编辑
PPT中,若对两个图形进行相关布尔运算:
结合 (msoMergeUnion)
组合 (msoMergeCombine)
拆分 (msoMergeFragment)
相交 (msoMergeIntersect)
剪除 (msoMergeSubtract)
使用的是 ShapeRange.MergeShapes(MergeCmd, PrimaryShape) 方法
但在2007中,提示 “方法和数据成员未找到” 的错误提示,
- Sub MerPic()
- Dim shp1 As Shape, shp2 As Shape
- Set shp1 = ActivePresentation.Slides(1).Shapes.AddShape(msoShapeOval, 100, 100, 50, 50)
- Set shp2 = ActivePresentation.Slides(1).Shapes.AddShape(msoShapePie, 100, 100, 50, 50)
- <pre style="box-sizing: border-box; border: 0px; font-family: inherit; font-size: 15px; margin-bottom: 5px; outline: 0px; vertical-align: baseline; text-align: justify; word-break: break-all; background-color: rgb(255, 255, 255);"><code class="prettyprint-override" style="box-sizing: border-box; border: 0px; font-family: inherit; font-style: inherit; outline: 0px; vertical-align: baseline;">Call ActiveWindow.Selection.SlideRange(1).Shapes.Range(Array(shp1.ZOrderPosition, shp2.ZOrderPosition)).MergeShapes(msoMergeCombine)</code></pre>End Sub
复制代码 或者改成,
- Sub hbing()
- Dim shp1 As Shape
- Dim shp2 As Shape
- Dim aShapeArray As Variant
- Dim oRange As ShapeRange
- Set shp1 = ActivePresentation.Slides(1).Shapes.AddShape(msoShapeOval, 100, 100, 50, 50)
- Set shp2 = ActivePresentation.Slides(1).Shapes.AddShape(msoShapePie, 100, 100, 50, 50)
- Set aShapeArray = ActivePresentation.Slides(1).Shapes.Range(Array(shp1.Name, shp2.Name))
- Set oRange = aShapeArray
- oRange.MergeShapes (msoMergeCombine) 'msoMergeUnion
- ActivePresentation.Slides(1).Shapes(ActivePresentation.Slides(1).Shapes.Count).Name = "BINGO!"
- End Sub
复制代码 都出错,.MergeShape 方法未在 Project 中实现(属性方法中也没有提示)
请教下是版本问题,还是引用问题?
能否在2007PPT中,用VBA实现两个图形上述各种的布尔处理运算?
再退一步,EXCEL能否用VBA实现图形的布尔运算?
|
|