VBA/Excel/Access/Word/PowerPoint/PowerPoint Format — различия между версиями

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

Текущая версия на 12:46, 26 мая 2010

Applying a Background to One or More Slides

 
Sub background()
    With Presentations("your.ppt").Slides(4)
        .FollowMasterBackground = msoFalse
        .DisplayMasterShapes = msoFalse
        With .Background
            .Fill.ForeColor.RGB = RGB(255, 255, 255)
            .Fill.BackColor.SchemeColor = ppAccent1
            .Fill.UserPicture "C:\Winter.jpg"
        End With
    End With
End Sub



Applying a Color Scheme to a Slide

 
Sub color()
    ActivePresentation.Slides.Range(Array(1, 2, 3)) _
        .ColorScheme.Colors(ppBackground).RGB = RGB(0, 0, 0)
End Sub



Check font size

 
 Option Explicit
 Function CheckMinFontSize(objPresentation As Presentation) As Boolean
     Dim objSlide As Slide
     Dim objShape As Shape
     CheckMinFontSize = True
     For Each objSlide In objPresentation.Slides
         objSlide.Select
         objSlide.Shapes.SelectAll
         For Each objShape In Windows(1).Selection.ShapeRange
             If objShape.Type = msoPlaceholder Then
                 If objShape.TextFrame.TextRange.Font.Size < 14 Then
                     CheckMinFontSize = False
                     Exit Function
                 End If
             End If
         Next objShape
     Next objSlide
 End Function
 Sub Font_Check()
     If CheckMinFontSize(ActivePresentation) = False Then
         Debug.Print "too small."
     End If
 End Sub



Displaying or Hiding a Header or Footer Object

 
Sub footerV()
    ActivePresentation.Slides(5).HeadersFooters.Footer.Visible = msoFalse
End Sub



PowerPoint format ppSaveAsPresentation

 
Sub save()
    ActivePresentation.SaveAs FileName:="C:\HR.ppt", _
        FileFormat:=ppSaveAsPresentation, EmbedTrueTypeFonts:=msoFalse
End Sub



Setting the Format for Date and Time Headers and Footers

 
Format                        Example 
ppDateTimeddddMMMMddyyyy      Thursday, October 05, 2006
ppDateTimedMMMMyyyy           5 October 2006
ppDateTimedMMMyy              5-Oct-06
ppDateTimeHmm                 10:17
ppDateTimehmmAMPM             10:17 AM
ppDateTimeHmmss               10:17:16
ppDateTimehmmssAMPM           10:17:16 AM
ppDateTimeMdyy                10/5/2006
ppDateTimeMMddyyHmm           10/5/2006 10:17 AM
ppDateTimeMMddyyhmmAMPM       10/5/2006 10:17:16 AM
ppDateTimeMMMMdyyyy           October 5, 2006
ppDateTimeMMMMyy              October 06
ppDateTimeMMyy                Oct-06



Setting the Text in a Header or Footer

 
Sub footerText()
    ActivePresentation.Slides(5).HeadersFooters.Footer.Text = "Confidential"
End Sub



Standardizing All the Headers and Footers in a Presentation

 
Sub Standardize_Headers_and_Footers()
    Dim myPresentation As Presentation, mySlide As slide
    Set myPresentation = ActivePresentation
    For Each mySlide In myPresentation.Slides
        mySlide.HeadersFooters.Clear
        mySlide.DisplayMasterShapes = msoTrue
    Next mySlide
    With myPresentation.SlideMaster.HeadersFooters
        With .Footer
            .Visible = msoCTrue
            .Text = "Company Confidential"
        End With
        With .DateAndTime
            .Visible = True
            .UseFormat = True
            .Format = ppDateTimeMMMMyy
        End With
    End With
End Sub
"Controlling the Show Type