powerpoint - Formatting images without select -
i'm want perform variety of formatting options on images in slides.
the macro runs on images i've selected in slide, i'd run macro without selecting images.
here's how i'm manipulating images (in case aligning image horizontal center of slide) , piece of code i'm looking replacing:
with activewindow.selection.shaperange .align (msoaligncenters), msotrue end
here's entire code body far:
sub testcenterimage() dim osld slide dim oshp shape each osld in activepresentation.slides if osld.slideindex > 1 exit sub 'i don't know if need line each oshp in osld.shapes if checkispic(oshp) = true 'making sure we're working images activewindow.selection.shaperange 'the portion of code need .align (msoaligncenters), msotrue end end if next oshp next osld end sub function checkispic(oshp shape) boolean if oshp.type = msopicture checkispic = true if oshp.type = msoplaceholder if oshp.placeholderformat.containedtype = msopicture checkispic = true end if end function
try way instead:
sub testcenterimage() dim osld slide dim oshp shape each osld in activepresentation.slides 'if osld.slideindex > 1 exit sub 'i don't know if need line each oshp in osld.shapes if checkispic(oshp) = true 'making sure we're working images centeronslide oshp 'end end if next oshp next osld end sub function checkispic(oshp shape) boolean if oshp.type = msopicture checkispic = true if oshp.type = msoplaceholder if oshp.placeholderformat.containedtype = msopicture checkispic = true end if end function sub centeronslide(oshp shape) dim sngslidewidth single dim sngslideheight single sngslidewidth = activepresentation.pagesetup.slidewidth sngslideheight = activepresentation.pagesetup.slideheight oshp.left = sngslidewidth / 2 - oshp.width / 2 oshp.top = sngslideheight / 2 - oshp.height / 2 end sub
Comments
Post a Comment