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:

   <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>
   
  


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

   <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>
   
  


Working with Headers and Footers

   <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>