Share via

Create PPTX / PPT programatically

Anonymous
2010-10-20T21:24:56+00:00

I would like to create programatically presentation based on data which I will get from Excel (PowerPivot)

Is it possible with PowerPoint object model (Microsoft.Office.Interop.PowerPoint).

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-10-20T23:36:38+00:00

Basic example of automating it from Excel.

Dim oPPT As Object 'PowerPoint.Application

Dim oPres As Object 'PowerPoint.Presentation

Dim oSld As Object 'PowerPoint.Slide

Range("A3:B25").CopyPicture

Set oPPT = CreateObject("PowerPoint.Application")

If Not oPPT Is Nothing Then

    oPPT.Visible = True 'make the window visible (optional)

    Set oPres = oPPT.presentations.Add(msoTrue)

    With oPres

        Set oSld = .Slides.AddSlide(1, .Designs(1).SlideMaster.CustomLayouts(1))

        With oSld

            With oSld.Shapes.Paste(1)

                .Top = 10

                .Left = 10

            End With

        End With

        .SaveAs "c:\temp\test.pptx", ppSaveAsDefault

    End With

Else

    MsgBox "PowerPoint object could not be instantiated.", vbExclamation

End If


Regards, Shyam Pillai. http://skp.mvps.org

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-10-21T00:07:04+00:00

    Thank you. AWESOME

    Was this answer helpful?

    0 comments No comments