VBA/Excel/Access/Word/PowerPoint/Slide Master
Содержание
- 1 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:
- 2 clears the HeaderFooter objects in the notes master in the first open presentation:
- 3 Deleting a Master
- 4 To find out whether a presentation has a title master, check the HasTitleMaster property
- 5 Working with Headers and Footers
- 6 Working with the Handout Master
- 7 Working with the Slide Master
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:
<source lang="vb">
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
</source>
<source lang="vb">
Sub header()
Presentations(1).NotesMaster.HeadersFooters.Clear
End Sub
</source>
Deleting a Master
<source lang="vb">
Sub titleMaster()
If ActivePresentation.HasTitleMaster Then ActivePresentation.TitleMaster.Delete
End Sub
</source>
To find out whether a presentation has a title master, check the HasTitleMaster property
<source lang="vb">
Sub hasMaster()
If Not ActivePresentation.HasTitleMaster Then ActivePresentation.AddTitleMaster
End Sub
</source>
<source lang="vb">
Sub footer()
ActivePresentation.SlideMaster.HeadersFooters.Footer.Text = "text"
End Sub
</source>
Working with the Handout Master
<source lang="vb">
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
</source>
Working with the Slide Master
<source lang="vb">
Sub addTitle()
ActivePresentation.SlideMaster.Shapes.addTitle.TextFrame.TextRange.Text = _ "Orientation"
End Sub
</source>