I am using the following VBA code to export PPT slides to images. The problem is that, for Slides 1 through 9, the filenames have only one character (eg: "1.png"). I need for those first nine slides to have TWO characters in their filename (eg: "01.png") to match the later slides (eg: "10.png").
How can I make that happen?
Thanks in advance!
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
For Each oSlide In ActivePresentation.Slides
sImageName = oSlide.SlideNumber & ".png"
oSlide.Export sImagePath & sImageName, "PNG"
Next oSlide
Err_ImageSave:
If Err <> 0 Then
MsgBox Err.Description
End If
End Sub
Function sImagePath() As String
sImagePath = ActivePresentaion.Path
End Function