Save PowerPoint slides as JPG image using VBA
We already know that it is possible to export your PowerPoint presentations to images (a single slide or every slide in your presentation) using the File -> Save As option.
However, if you need to do this programmatically you can use VBA Visual Basic for Applications to achieve this task. This can be helpful for example if you need to provide a button for the users and make interactive presentations in PowerPoint so when the user (audience, presenter or just any user who receive the ppt file) clicks on the button the PowerPoint can be saved as images.
Save PowerPoint slides as JPG image using VBA
This snippet from vbadud can do the job for us.
Sub Save_PowerPoint_Slide_as_Images() Dim sImagePath As String Dim sImageName As String Dim oSlide As Slide '* Slide Object Dim lScaleWidth As Long '* Scale Width Dim lScaleHeight As Long '* Scale Height On Error GoTo Err_ImageSave sImagePath = "C:\Output\" For Each oSlide In ActivePresentation.Slides sImageName = oSlide.Name & ".jpg" oSlide.Export sImagePath & sImageName, "JPG" Next oSlide Err_ImageSave: If Err <> 0 Then MsgBox Err.Description End If End Sub
If you change the output filename to .png you can save using PNG format instead of JPG, which can be useful if you don’t want to lose quality in the output slide.
You can see the original article in http://vbadud.blogspot.com