VBA/Excel/Access/Word/PowerPoint/Slide Edit
Содержание
- 1 Accessing a Slide by Name
- 2 assigns to the SlideRange object variable mySlideRange the slides named Intro and Outro in the active presentation:
- 3 Changing the Layout of an Existing Slide
- 4 Copying and Pasting a Slide
- 5 Deleting an Existing Slide
- 6 Duplicating a Slide
- 7 Finding a Slide by Its ID Number
- 8 Inserting Slides from an Existing Presentation
- 9 Moving a Slide
- 10 Working with a Range of Slides
Accessing a Slide by Name
Sub Name()
ActivePresentation.Slides(1).Name = "Introduction"
ActivePresentation.Slides("Introduction").Select
End Sub
assigns to the SlideRange object variable mySlideRange the slides named Intro and Outro in the active presentation:
Sub rangeArray()
Set mySlideRange = ActivePresentation.Slides.Range(Array("Intro", "Outro"))
End Sub
Changing the Layout of an Existing Slide
Sub layout()
ActivePresentation.Slides(1).Layout = ppLayoutClipArtAndVerticalText
End Sub
Copying and Pasting a Slide
Sub copy()
ActivePresentation.Slides(1).Copy
ActivePresentation.Slides.Paste Index:=5
End Sub
Deleting an Existing Slide
Sub del()
ActivePresentation.Slides(1).Delete
End Sub
Duplicating a Slide
Sub Duplicate()
ActivePresentation.Slides(4).Duplicate
End Sub
Finding a Slide by Its ID Number
Sub addFromFile()
Dim TargetSlide As Long
TargetSlide = ActivePresentation.Slides.Add(Index:=5, Layout:=ppLayoutFourObjects).SlideID
Presentations("C.ppt").Slides.InsertFromFile _
FileName:="C:\A.ppt", Index:=3
ActivePresentation.Slides.FindBySlideID(TargetSlide).ApplyTemplate _
FileName:="C:\B.pot"
End Sub
Inserting Slides from an Existing Presentation
Sub insert()
Presentations("Corporate.ppt").Slides.InsertFromFile _
FileName:="C:\Your.ppt", Index:=5, _
SlideStart:=2, SlideEnd:=8
End Sub
Moving a Slide
Sub move()
ActivePresentation.Slides(3).MoveTo ToPos:=1
End Sub
Working with a Range of Slides
Sub range()
Dim mySlideRange As SlideRange
Set mySlideRange = Presentations("HR.ppt").Slides.Range(Array(1, 2, 3, 4, 5))
End Sub