VBA/Excel/Access/Word/PowerPoint/Slide Master

Материал из VB Эксперт
Перейти к: навигация, поиск

Checks that the title master exists and, if it does, formats the date and time to be visible and to use the dMMMyy format with automatic updating:

Sub master()
    With ActivePresentation
        If .HasTitleMaster Then
            With .TitleMaster.HeadersFooters.DateAndTime
                .Visible = msoTrue
                .Format = ppDateTimedMMMyy
                .UseFormat = msoTrue
            End With
        End If
    End With
End Sub

clears the HeaderFooter objects in the notes master in the first open presentation:

Sub header()
End Sub

Deleting a Master

Sub titleMaster()
    If ActivePresentation.HasTitleMaster Then ActivePresentation.TitleMaster.Delete
End Sub

To find out whether a presentation has a title master, check the HasTitleMaster property

Sub hasMaster()
    If Not ActivePresentation.HasTitleMaster Then ActivePresentation.AddTitleMaster
End Sub

Working with Headers and Footers

Sub footer()
    ActivePresentation.SlideMaster.HeadersFooters.Footer.Text = "text"
End Sub

Working with the Handout Master

Sub background()
    With ActivePresentation.HandoutMaster.Background
        .Fill.ForeColor.RGB = RGB(255, 255, 255)
        .Fill.BackColor.SchemeColor = ppAccent1
        .Fill.UserPicture "d:\n.jpg"
    End With
End Sub

Working with the Slide Master

Sub addTitle()
    ActivePresentation.SlideMaster.Shapes.addTitle.TextFrame.TextRange.Text = _
End Sub