Changing the file type of photos in Powerpoint presentation using VBA? -


i have powerpoint presentation photo on each slide large file size (.emf). change them .png make final file size smaller.

so far, have this:

sub convertshapetopng()     dim osh shape     set osh = activewindow.selection.shaperange(1)     osh.copy     activewindow.selection.sliderange.shapes.pastespecial pppastepng     osh.delete end sub 

this take picture selected on slide , replace png. having trouble having work throughout presentation wants me select picture first.

this code full presentation version:

sub convertallshapestopng()  dim osld slide dim osh shape  each osld in activepresentation.slides     each osh in osld.shapes         set osh = activewindow.selection.shaperange(1)         osh.copy         activewindow.selection.sliderange.shapes.pastespecial pppastepng         osh.delete     next next osld  end sub 

can me run code throughout entire presentation? thanks!

edit: ideal if photos copy same location original photo instead of copying centre of slide have not tried myself yet.

i figured out myself!

here code if curious:

sub convertallshapestopng() 'purpose: change pictures .png images  dim shp shape dim sld slide dim pic shape dim shp_left double dim shp_top double  'loop through each slide in activepresentation   each sld in activepresentation.slides     each shp in sld.shapes        if shp.type = msopicture         'retrieve current positioning           shp_left = shp.left           shp_top = shp.top          'copy/paste .png picture           shp.copy            sld.shapes.pastespecial datatype:=pppastepng            set pic = sld.shapes(sld.shapes.count)          'delete linked shape           shp.delete          'reposition newly pasted picture           pic.left = shp_left           pic.top = shp_top        end if      next shp   next sld    msgbox "all photos .pngs"  end sub 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -