Reputation: 339
overall idea is user selects something from a drop down, then a shape grows based on their selection. I am able to get the dropdown and identify which shape I need the grow / shrink on, but not able to add the grow.
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
The error is Object Variable or With block not set. Thanks!
Upvotes: 0
Views: 857
Reputation: 53623
Because myShape
is an object variable, you need to use the Set
keyword when assigning to it.
Set myShape = myDocument.Shapes("Illinois")
statements such as myDocument.Shapes("Illinois").Height also execute fine
That's because the .Height
is a non-object property which is assigned without the keyword, for example you may have assigned to the .Height
like so:
myDocument.Shapes("Illinois").height = 300
But when referring to the shape itself, you do need it as an object with the Set
keyword.
Upvotes: 2