PowerPoint aus Excel - Format 16:9

Frage: Besteht die Möglichkeit das Seitenformat einer neu zu erstellenden PowerPoint Präsentation per VBA aus Excel heraus auf 16:9 umzustellen?

Option Explicit
Const ppSlideSizeOnScreen16x9 As Long = 15
Const ppLayoutBlank As Long = 12
Dim blnPPT As Boolean
Dim objPP As Object
Public Sub Main()
    On Error GoTo Fin
    Set objPP = OffApp("PowerPoint")
    If Not objPP Is Nothing Then
        With objPP
            .Visible = True
            .Presentations.Add
            .ActivePresentation.Slides.Add 1, ppLayoutBlank
            .ActivePresentation.PageSetup.SlideSize = ppSlideSizeOnScreen16x9
        End With
    Else
        MsgBox "Application not installed!"
    End If
Fin:
    MsgBox "Nach Klick wird PowerPoint wieder geschlossen!", 64
    If Not objPP Is Nothing Then
        If blnPPT = True Then
            objPP.Quit
            blnPPT = False
        End If
    End If
    Set objPP = Nothing
    If Err.Number <> 0 Then MsgBox "Fehler: " & _
        Err.Number & " " & Err.Description
End Sub
Private Function OffApp(ByVal strApp As String, _
    Optional blnVisible As Boolean = True) As Object
    On Error Resume Next
    Set objPP = GetObject(, strApp & ".Application")
    Select Case Err.Number
        Case 429
            Err.Clear
            Set objPP = CreateObject(strApp & ".Application")
            blnPPT = True
            If blnVisible = True Then
                On Error Resume Next
                objPP.Visible = True
                Err.Clear
            End If
    End Select
    On Error GoTo 0
    Set OffApp = objPP
    Set objPP = Nothing
End Function

Beliebte Posts aus diesem Blog

Formeln - auch Array - per VBA eintragen...

Alle Dateien eines Ordners - Optional mit Unterordner

Excel -> Word in Textmarken (Bookmarks)...