Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

How to automate PowerPoint using VB

Microsoft has an article that explains how to automate PowerPoint using VB

For some odd reason they've entitled it How to automate Powerpoint using VB

Here's a quick example:

Sub AutomatePowerPoint()
    ' This requires that you set a reference to PowerPoint in Tools, References
    ' You could later change these to As Object to avoid that necessity
    Dim oPPTApp As PowerPoint.Application   
    Dim oPPTPres As PowerPoint.Presentation
    Dim sPresentationFile as String

    sPresentationFile = "C:\MyFiles\Somefile.PPT"

    ' Get a reference to PowerPoint app
    Set oPPTApp = New PowerPoint.Application
    '  set it visible or you may get errors - there are ways around this but they're
   '  beyond the scope of this FAQ
    oPPTApp.Visible = True
    ' minimize if you want to hide it:
    ' oPPTApp.WindowState = ppWindowMinimized

    ' Open our source PPT file, get a reference to it
    Set oPPTPres = oPPTApp.Presentations.Open(sPresentationFile)

    With oPPTPres     ' Do stuff ...
      ' Show the number of slides in the file, for example  
      msgbox .Slides.Count           
    End With

    ' Cleanup
    ' Close the presentation
    oPPTPres.Close
    ' Quit PPT
    oPPTApp.Quit
    ' Release variables
    Set oPPTPres = Nothing
    Set oPPTApp = Nothing

End Sub


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

How to automate PowerPoint using VB
http://www.pptfaq.com/FAQ00115_How_to_automate_PowerPoint_using_VB.htm
Last update 23 August, 2013
Created: