总体思路是,用户从下拉菜单中选择某项,然后形状会根据他们的选择而增长。我能够获得该下拉列表,并确定需要在其上进行生长/收缩的形状,但是无法添加该生长。
Set myDocument = ActivePresentation.Slides(2)
Dim myShape As Shape
myShape = myDocument.Shapes("Illinois")
Dim oEffect As Effect
Set oEffect = myDocument.TimeLine.MainSequence.AddEffect(Shape:=myShape, effectid:=msoAnimEffectGrowShrink)
With oEffect
.EffectParameters.Size = 30
.EffectType = msoAnimEffectGrowShrink
.Timing.Duration = 2
End With
错误是对象变量或未设置With块。谢谢!
因为myShape
是对象变量,所以Set
在分配给它时需要使用关键字。
Set myShape = myDocument.Shapes("Illinois")
诸如myDocument.Shapes(“ Illinois”)。Height之类的语句也可以很好地执行
这是因为.Height
是非对象属性,该属性是在没有关键字的情况下分配的,例如,您可能已经分配给了.Height
这样的对象:
myDocument.Shapes("Illinois").height = 300
但是,当引用形状本身时,您确实需要将它作为带有Set
关键字的对象。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句