Export all the slides from a powerpoint presentation

This is a very simple Visual Basic source code to export all the slides from a powerpoint presentation. This source code can export images in any specified image format like .jpg, .bmp or .gif. I wrote this function while I was working on my undergraduate project “PowerPoint to XML Interchangeability”. I had to make some sort of PowerPoint Viewer to view the slides so I wrote this function to export powerpoint slides into image sequences so that I can display them into an image control and export the images at a temporary location.

'*     MYCPLUS Sample Code - http://www.mycplus.com     *
'*                                                     *
'*   This code is made available as a service to our   *
'*      visitors and is provided strictly for the      *
'*               purpose of illustration.              *
'*                                                     *
'* Please direct all inquiries to saqib at mycplus.com *

Public Function ExportImages()

	Dim a As PowerPoint.Application
	Set a = New PowerPoint.Application

	Dim pPpx As PowerPoint.Presentation

	Set pPpx = a.Presentations.Open("c:\pc.ppt", msoTrue, msoTrue, msoFalse)

	For i = 1 To pPpx.Slides.Count
	    pPpx.Slides(i).Export App.Path & "lslide" & i & ".jpg", "jpg", 800, 600
	Next i
	Set pPpx = Nothing

End Function

Leave a Reply