问题
I have a small tool to export the pictures inside ppt documents to image files, so I can import them somewhere else. For this, I have been using the following piece of code:
For Each slideShape In slide
If slideShape.Type = msoPicture Then
Call slideShape.Export(materialPresentation.Path & "\" & ecode & "_" & cont & ".jpg", ppSaveAsJPG)
cont = cont + 1
End If
Next slideShape
However, in a different tool, I am required to export all the shapes of a slide at once, exactly like selecting them with the mouse, and clicking in "Save as image", which creates an image with all the shapes.
Is there a way to do it using VBA? All I found online were examples of exporting single shapes (Which I already know).
回答1:
Group the shapes you want to export then export the resulting group shape.
回答2:
What may also work is exporting via ShapeRange (slide
is a Slide
object), e.g.
slide.Shapes.Range().Export("C:\output.jpg", ppShapeFormatJPG)
来源:https://stackoverflow.com/questions/25427404/save-all-shapes-of-slide-into-single-jpg-image