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

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.

Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF

Invoke PPT and run a macro from VB

Sub RunPPT-InvokeMacro()
' Execute Powerpoint and invoke the macro EXAMPLE
' EXAMPLE must be available to PPT, in an auto-loaded add-in, for example

' Start PowerPoint
Dim oPPTApp As PowerPoint.Application

On Error Resume Next
Set oPPTApp = New PowerPoint.Application
oPPTApp.Visible = True

' Were we able to start PPT?
If Err.Number <> 0 Then
oPPTApp.Quit
Set oPPTApp = Nothing
Exit Sub
End If

' Insert other error/sanity checks here to ensure that there really is an instance
' of PPT loaded

' Having established that PPT is loaded you could also test for the presence of the expected add-in
Dim lTemp as Long
Dim bAddinLoaded as Boolean
For lTemp = 1 to oPPTApp.Addins.Count
if oPPTApp.Addins(lTemp) = "YourAddin" then
bAddinLoaded = True
end if
Next lTemp

if not bAddinLoaded Then
oPPTApp.Quit
Set oPPTApp = Nothing
Exit Sub
End if

oPPTApp.Run "EXAMPLE"

' And quit PPT
oPPTApp.Quit

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 - 2015 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.
Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese

Supercharge your PPT Productivity with PPTools

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

Invoke PPT and run a macro from VB
http://www.pptfaq.com/FAQ00580_Invoke_PPT_and_run_a_macro_from_VB.htm
Last update 07 June, 2011
Created: