PDA

View Full Version : VBA to save all Smartart as images



k8peterson
10-17-2019, 08:21 AM
Hello,

I am at the end of my rope trying to figure a way to export many PowerPoint files so that they can be used on a web application. I have tried to automate the process by exporting to HTML, (using both PP/Windows and online convertors) but it is not giving me exactly what I need. I need to be able to replicate the process of right-clicking on a smart art element and saving it as an image. Ideally this will all be saved with file names according to their slide number.

slide1-image1.png
slide1-image2.png
slide2-image1.png

Is there a VBA script that can do this? I need all the background elements and text in the SmartArt as one flat image.

THANK YOU TO ANYONE WHO CAN HELP!!

k8peterson
10-26-2019, 09:19 AM
Bumping - any thoughts on a VBA to export all smart art as images?

John Wilson
10-28-2019, 06:18 AM
I'm on a plane so you will need to work on this but here's the basis



Sub ex_SA()
Dim oshp As Shape
Dim osld As Slide
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoSmartArt Then
Call oshp.Export(Environ("USERPROFILE") & "\Desktop\Slide " & _
CStr(osld.SlideIndex) & " " & CStr(oshp.Name) & ".Png", ppShapeFormatPNG)
End If
Next
Next
End Sub