VBA - linking applications videos | Excel VBA Part 28 - Creating PowerPoint Presentations

Posted by Andrew Gould on 26 March 2014

Writing VBA code in Excel doesn't only allow you to control Excel, you also have access to all of the other Office applications. This video looks at how to create presentations in Microsoft PowerPoint by writing code in Excel. You'll learn how to reference the PowerPoint Object Library, several methods for creating a new instance of the PowerPoint application, how to create new presentations and insert slides and how to copy data from Excel into PowerPoint. You'll also learn the importance of testing for which version of PowerPoint your users are running and how to write version-independent code that will work with (almost) any version of PowerPoint.

See our full range of VBA training resources, or test your knowledge of VBA with one of our VBA skills assessment tests.

There are no files which go with this video.

There are no exercises for this video.

Making a  video bigger

You can increase the size of your video to make it fill the screen like this:

View full screen

Play your video (the icons shown won't appear until you do), then click on the full screen icon which appears as shown at its bottom right-hand corner.


When you've finished viewing a video in full screen mode, just press the Esc key to return to normal view.

Improving the quality of a video

To improve the quality of a video, first click on the Settings icon:

Settings icon

Make sure you're playing your video so that the icons shown appear, then click on this gear icon at the bottom right-hand corner.


Choose to change the video quality:

Video quality

Click on Quality as shown to bring up the submenu.


The higher the number you choose, the better will be your video quality (but the slower the connection speed):

Connection speed

Don't choose the HD option unless you have a fast enough connection speed to support it!


Is your Wise Owl speaking too slowly (or too quickly)?  You can also use the Settings menu above to change your playback speed.

This page has 1 thread Add post
21 Mar 19 at 15:56


I followed your video but encountered an error on this line:


I think the reason is I am using Excel 2010, whereas you are using Excel 2013.

Can you tell me how can I adapt it to work for Excel 2010?



25 Mar 19 at 11:53

Hi duggie,

This code works for PowerPoint 2010 with the code written in Excel 2010 using a reference to the Microsoft PowerPoint 14.0 Object Library:

Sub TestPresentation()

    Dim ppt As PowerPoint.Application
    Dim pres As PowerPoint.Presentation
    Dim sld As PowerPoint.Slide
    Shell "C:\Program Files (x86)\Microsoft Office\Office14\POWERPNT.EXE", vbNormalFocus
    Set ppt = GetObject(Class:="PowerPoint.Application")
    Set pres = ppt.Presentations(1)
    Set sld = pres.Slides(1)
    sld.Shapes(1).TextFrame2.TextRange.Text = "Test Presentation"
    sld.Shapes(2).TextFrame2.TextRange.Text = "Wise Owl"
    Set sld = pres.Slides.Add(2, ppLayoutBlank)
    sld.Shapes.PasteSpecial ppPasteOLEObject
    Set sld = pres.Slides.Add(3, ppLayoutBlank)
End Sub

I hope that helps!

05 Apr 19 at 09:52

Thanks Andrew, that finally did the trick.



29 Mar 19 at 10:46


Thanks for the update. Unfortunately I encountered the following problems when running your amended code:

When I copied and pasted your code into a new VBA workbook, I ran it and got this error:

            Run-time error '-2147188160 (80048240)':
            Presentations (unknown member): Integer out of range. 1 is not in the valid range 1 to 0.

Powerpoint is opened with a blank slide

I pressed the Debug option and this line is highlighted:

            Set pres = ppt.Presentations(1)

  I changed the 1 to a 0 (I wasn't sure what to do!) and pressed F5. I immediately got this error message:

            Run-time error '-2147188160 (80048240)':
            Presentations (unknown member): Integer out of range. 0 is not in the valid range 1 to 1.

I pressed Debug and the same line was at fault,

            Set pres = ppt.Presentations(0)

so I changed it back from 0 to 1 and pressed F5.

Then I got a different error:

            Run-time error '9'
            Subscript out of range

though Powerpoint now contains a slide with Test Presentation and Wise Owl

Pressing debug shows this line at fault:


Can you tell me if the problem lies with my Excel / Powerpoint combination or could it be something else?




Andrew G  
29 Mar 19 at 11:15

Hi duggie,

You can change this line:

Set pres = ppt.Presentations(1)

To this:

Set pres = ppt.Presentations.Add

The following line assumes that you have a chart called Chart1:


You can change "Chart1" to the name of the chart you want to copy.

I hope that helps!

Incidentally, i had to use the following line in order to make PowerPoint 2010 run on my machine as I have later versions of Office installed:

Shell "C:\Program Files (x86)\Microsoft Office\Office14\POWERPNT.EXE", vbNormalFocus

If you only have Office 2010 installed you can remove the above line and then alter the line which uses the GetObject function to the version shown below:

Set ppt = CreateObject(Class:="PowerPoint.Application")