VBA/Excel/Access/Word/PowerPoint/Slide Shape
Содержание
- 1 add a bent-up arrow to the upper-right corner of the penultimate slide in the active presentation:
- 2 Copying Formatting from One Shape to Another
- 3 Deleting a Shape
- 4 Finding Out Whether a Shape Has a Text Frame
- 5 Repositioning and Resizing a Shape
- 6 Selecting All Shapes
- 7 Setting an Animation for a Shape or a Range of Shapes
- 8 Works with the first shape on the third slide of the presentation, moving it 100 points to the left and 200 points down, and rotating it 90 degrees counterclockwise:
add a bent-up arrow to the upper-right corner of the penultimate slide in the active presentation:
Sub bendUp()
ActivePresentation.Slides(ActivePresentation.Slides.Count 1) _
.Shapes.AddShape Type:=msoShapeBentUpArrow, Left:=575, Top:=10, _
Width:=150, Height:=75
End Sub
Copying Formatting from One Shape to Another
Sub active()
With ActivePresentation
.Slides(2).Shapes(1).PickUp
.Slides(4).Shapes(3).Apply
End With
End Sub
Deleting a Shape
Sub del()
ActivePresentation.Slides(2).Shapes(1).Delete
End Sub
Finding Out Whether a Shape Has a Text Frame
Sub shape()
If ActivePresentation.Slides(1).Shapes(1).HasTextFrame = msoTrue Then
MsgBox "The shape contains a text frame."
End If
End Sub
Repositioning and Resizing a Shape
Sub pos()
With ActivePresentation.Slides(1).Shapes(1)
.Left = 200
.Top = 100
.Width = 300
.Height = 200
End With
End Sub
Selecting All Shapes
Sub select()
ActivePresentation.Slides(myPresentation.Slides.Count).Shapes.SelectAll
End Sub
Setting an Animation for a Shape or a Range of Shapes
"Applies a custom animation to the first shape on the slide.
Sub setting()
With ActiveSlide.Shapes(1).AnimationSettings
.EntryEffect = ppEffectFlyFromRight
.AdvanceMode = ppAdvanceOnClick
.SoundEffect.ImportFromFile FileName:="D:\Whistle.wav"
.TextLevelEffect = ppAnimateByFirstLevel
.TextUnitEffect = ppAnimateByParagraph
End With
End Sub
Works with the first shape on the third slide of the presentation, moving it 100 points to the left and 200 points down, and rotating it 90 degrees counterclockwise:
Sub shape()
With ActivePresentation.Slides(3).Shapes(1)
.IncrementLeft Increment:=-100
.IncrementTop Increment:=200
.IncrementRotation Increment:=-90
End With
End Sub