Share via

controlling file names when saving slides as PNG

Anonymous
2017-12-01T21:43:55+00:00

When saving many power points slides as PNG, it puts it in a folder and names all the slides, slide1.PNG and slide2.PNG and so-forth.  I want to know if there is a way I can set up a prefix such as mathslide1.PNG and mathslide2.PNG and so forth?  I know how to do it one at a time, I need help doing this in bulk.

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2017-12-02T19:20:39+00:00

    Totally agree and caused by copying before I made the change from the previous code.

    Other things on my mind right now.

    Was this answer helpful?

    0 comments No comments
  2. Steve Rindsberg 99,166 Reputation points MVP Volunteer Moderator
    2017-12-02T16:29:00+00:00

    Hey John,

    This line in your code:

    osld.Export Environ("USERPROFILE") & "\Desktop\slides" & Getname(osld), "JPG"

    should be more like this:

    osld.Export Environ("USERPROFILE") & "\Desktop\slides" & "SomeName-" & Format(osld.SlideIndex,"0000") & ".JPG", "JPG"

    Bill:

    That will export each slide to a file called SomeName-0001.JPG, SomeName-0002.JPG and so on.

    Change "SomeName-" to suit yourself. 

    If you want the numbers padded to a different number of digits (01, 01 or 00001, 00002 for example) change "0000" to reflect the number of digits ("00" or "00000" for example)

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-12-02T11:36:36+00:00

    The code in my previous code would work but it is for a slightly different use. The code to do what you need is simpler.

    NOTE this code has been corrected as per Steve's Comment

    Try:

    Sub exportSlides()

    On Error Resume Next

    MkDir (Environ("USERPROFILE") & "\Desktop\slides")

    Dim osld As Slide

    For Each osld In ActivePresentation.Slides

    osld.Export Environ("USERPROFILE") & "\Desktop\slides" & "mathsslide" & osld.SlideIndex & ".JPG","JPG"

    Next osld

    End Sub

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2017-12-02T01:42:07+00:00

    Hi Bill,

    The user interface in PowerPoint automatically names the individual slides that you save as a PNG file with a default name that you can then change manually later. However, it is possible though to achieve changing the name automatically to your desired format by using macros or VBA scripting. You can refer to the posts of one of our MVP's John SR Wilson in this thread. There is suggested code that was posted and you can attempt to verify if that will work with your current needs. Take note that the macro suggested was for an older version of PowerPoint.

    Feel free to reach out to us for further concerns.

    Was this answer helpful?

    0 comments No comments