VBA/Excel/Access/Word/PowerPoint/Slide Edit

Материал из VB Эксперт
Версия от 12:46, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

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