shp.Export returns shapes with undersized dimensions.

Nick Green 40 Reputation points
2024-08-26T12:07:17.6266667+00:00

Hello community!

I continue to figure out the script that automatically outputs all shapes of each slide as pictures. I use this script in my work to extract all objects from all slides and edit them in other software. I found the following incomprehensible problem in the script. This is that the script for some reason returns pictures with significantly reduced dimensions, which worsens the image quality. At the same time, manually clicking "save as picture" option returns images with higher dimensions.

The script I use:

Sub ExportShapesAsPNGs()
    Dim sld As Slide
    Dim shp As Shape
    Dim path As String
    Dim name As String
    Dim i As Integer

    path = "path to export folder\"

    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
                i = i + 1
                name = sld.name & "_" & i & ".png"
                shp.Export path & name, ppShapeFormatPNG
        Next shp
    Next sld
    MsgBox i & " shapes exported as PNGs."
End Sub


The size of the picture obtained using the script: 587 x 349 pixels.

The same shape output using manual clicking "save as picture" option has the dimensions: 2012 x 1201 pixels.

So the question is, why does the script output pictures with small dimensions and how can I change it so that it outputs objects with the same dimensions as when manually clicking the "save as picture" option?

Link to the test slide on Dropbox: https://www.dropbox.com/scl/fi/ffscjr4h9uecx9rht554e/Test.pptx?rlkey=r6tkgfamgs0idpuavfdhbchr7&st=53borscb&dl=0

PowerPoint
PowerPoint
A family of Microsoft presentation graphics products that offer tools for creating presentations and adding graphic effects like multimedia objects and special effects with text.
285 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,862 questions
PowerPoint Management
PowerPoint Management
PowerPoint: A family of Microsoft presentation graphics products that offer tools for creating presentations and adding graphic effects like multimedia objects and special effects with text.Management: The act or process of organizing, handling, directing or controlling something.
228 questions
0 comments No comments
{count} votes

Accepted answer
  1. John Korchok 5,326 Reputation points
    2024-08-26T18:57:08.3+00:00

    Here is Microsoft's page on how to set the export resolution of PowerPoint for Windows:

    https://learn.microsoft.com/en-us/office/troubleshoot/powerpoint/change-export-slide-resolution

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.