本文介绍了通过ID或名称获取形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果知道其 Id ,有什么方法可以得到形状?

Is there any way to get a shape if you know its Id?

例如:

Dim myshape As Shape
myshape.Id = 42
myshape = getShapeById(myshape.Id)

或者我可以通过 Name 来获得形状?

Or, alternatively, could I get the shape by Name?

Dim myshape As Shape
myshape.Name = "Rectangle 42"
myshape = getShapeByName(myshape.Name)


推荐答案

获得名称的形状,您可以...

To get a Shape by Name, you do...:

Function getShapeByName(shapeName As String, Slide As Integer)
    Set getShapeByName = ActivePresentation.Slides(Slide).Shapes(shapeName)
End Function

Dim myshape As Shape
myshape = getShapeByName("Rectangle 42", 1)

这篇关于通过ID或名称获取形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-22 04:22