Select powerpoint 幻灯片上最靠后的对象,带有 via
Select the back most object on a powerpoint slide with via
我有一个任务需要导入大量 emf 图形,将它们转换为形状,取消组合并删除最后面的对象。我们正在做的事情不需要这个对象。如果我知道它的名字是什么,我可以用 select 和 vba,我认为每次都不一样。
有人建议我如何 select 删除最后面的对象吗?
任何建议都会有所帮助。
Dim oSh As Shape
Dim oBGShape As Shape
Dim lZorder As Long
Dim oTempRange As ShapeRange
Dim x As Long
Set oSh = ActivePresentation.Slides(1).Shapes("EMFGraphic")
lZorder = oSh.ZOrderPosition
' oSh.Ungroup returns a shaperange
With oSh.Ungroup
' ungrouping again is usually necessary
' we want the first shape in the new shaperange
Set oTempRange = .Ungroup
Set oBGShape = oTempRange(1)
End With
oBGShape.Fill.Visible = True
oBGShape.Fill.ForeColor.RGB = RGB(123, 123, 123)
oBGShape.Left = 0
MsgBox "The bg shape should now be at the left side of the slide and gray"
oBGShape.Delete
While .ZOrderPosition > lZorder
.ZOrder (msoSendBackward)
Wend
' If you want to regroup the shapes, you'll have to add them to an array
' after the first ungroup
' then use something like this to send the regrouped shape to the original
' zorder, if need be:
' While .ZOrderPosition > lZorder
' .ZOrder (msoSendBackward)
' Wend
请注意,每次您 运行 执行此操作时,原始组的名称都将丢失并且不会 return 撤消,因此您必须重新应用该名称每次到图形,如果名称是您使用它所依赖的名称。
我有一个任务需要导入大量 emf 图形,将它们转换为形状,取消组合并删除最后面的对象。我们正在做的事情不需要这个对象。如果我知道它的名字是什么,我可以用 select 和 vba,我认为每次都不一样。
有人建议我如何 select 删除最后面的对象吗?
任何建议都会有所帮助。
Dim oSh As Shape
Dim oBGShape As Shape
Dim lZorder As Long
Dim oTempRange As ShapeRange
Dim x As Long
Set oSh = ActivePresentation.Slides(1).Shapes("EMFGraphic")
lZorder = oSh.ZOrderPosition
' oSh.Ungroup returns a shaperange
With oSh.Ungroup
' ungrouping again is usually necessary
' we want the first shape in the new shaperange
Set oTempRange = .Ungroup
Set oBGShape = oTempRange(1)
End With
oBGShape.Fill.Visible = True
oBGShape.Fill.ForeColor.RGB = RGB(123, 123, 123)
oBGShape.Left = 0
MsgBox "The bg shape should now be at the left side of the slide and gray"
oBGShape.Delete
While .ZOrderPosition > lZorder
.ZOrder (msoSendBackward)
Wend
' If you want to regroup the shapes, you'll have to add them to an array
' after the first ungroup
' then use something like this to send the regrouped shape to the original
' zorder, if need be:
' While .ZOrderPosition > lZorder
' .ZOrder (msoSendBackward)
' Wend
请注意,每次您 运行 执行此操作时,原始组的名称都将丢失并且不会 return 撤消,因此您必须重新应用该名称每次到图形,如果名称是您使用它所依赖的名称。