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 in the presentation. This Visual Basic function exports PowerPoint slides into image sequences so that you can display them into an image control. Later on these images can be exported into the file system at a temporary location for subsequent use.

Public Function ExportImages()

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

Dim pPpx As PowerPoint.Presentation

Set pPpx = a.Presentations.Open("c:\presentation.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