VBA/Excel/Access/Word/PowerPoint/Slide Edit — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 19:33, 26 мая 2010
Содержание
- 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
<source lang="vb">
Sub Name()
ActivePresentation.Slides(1).Name = "Introduction" ActivePresentation.Slides("Introduction").Select
End Sub
</source>
assigns to the SlideRange object variable mySlideRange the slides named Intro and Outro in the active presentation:
<source lang="vb">
Sub rangeArray()
Set mySlideRange = ActivePresentation.Slides.Range(Array("Intro", "Outro"))
End Sub
</source>
Changing the Layout of an Existing Slide
<source lang="vb">
Sub layout()
ActivePresentation.Slides(1).Layout = ppLayoutClipArtAndVerticalText
End Sub
</source>
Copying and Pasting a Slide
<source lang="vb">
Sub copy()
ActivePresentation.Slides(1).Copy ActivePresentation.Slides.Paste Index:=5
End Sub
</source>
Deleting an Existing Slide
<source lang="vb">
Sub del()
ActivePresentation.Slides(1).Delete
End Sub
</source>
Duplicating a Slide
<source lang="vb">
Sub Duplicate()
ActivePresentation.Slides(4).Duplicate
End Sub
</source>
Finding a Slide by Its ID Number
<source lang="vb">
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
</source>
Inserting Slides from an Existing Presentation
<source lang="vb">
Sub insert()
Presentations("Corporate.ppt").Slides.InsertFromFile _ FileName:="C:\Your.ppt", Index:=5, _ SlideStart:=2, SlideEnd:=8
End Sub
</source>
Moving a Slide
<source lang="vb">
Sub move()
ActivePresentation.Slides(3).MoveTo ToPos:=1
End Sub
</source>
Working with a Range of Slides
<source lang="vb">
Sub range()
Dim mySlideRange As SlideRange Set mySlideRange = Presentations("HR.ppt").Slides.Range(Array(1, 2, 3, 4, 5))
End Sub
</source>