Powerpoint VBA Harvey Balls -
i'm trying create harvey balls vba code in powerpoint 2010+. this, i'm inserting circle shape , pie 1 , combine them. works fine if i'm inserting 2 shapes ribbon , align , combine them, when i'm inserting shapes vba, result of combining them different , don't understand why.
so:
- insert shapes ribbon -> align using ribbon -> combine using ribbon -> ok
- insert shapes vba -> align using ribbon -> combine using ribbon -> wrong result
you can see in this video.
vba code inserting shapes (very basic) below.
activepresentation.slides(slide_num).shapes.addshape(msoshapeoval, 100, 100, 50, 50).select activepresentation.slides(slide_num).shapes.addshape(msoshapepie, 200, 100, 50, 50).select
help, please!
if absolute value of both adjustments of pie (the yellow diamonds) of following 0, 90, 180, 270 values combine behaves substract geometry operation. looks bug in combine geometry. instead, if set value of 90.01 expected behavior.
sub test1() dim shp1 shape dim shp2 shape set shp1 = activepresentation.slides(1).shapes.addshape(msoshapeoval, 100, 100, 50, 50) set shp2 = activepresentation.slides(1).shapes.addshape(msoshapepie, 100, 100, 50, 50) call activewindow.selection.sliderange(1).shapes.range(array( shp1.zorderposition, shp2.zorderposition)).mergeshapes(msomergecombine) end sub
sub test2() dim shp1 shape dim shp2 shape set shp1 = activepresentation.slides(1).shapes.addshape(msoshapeoval, 200, 100, 50, 50) set shp2 = activepresentation.slides(1).shapes.addshape(msoshapepie, 200, 100, 50, 50) shp2.adjustments(1) = shp2.adjustments(1) + 0.1 call activewindow.selection.sliderange(1).shapes.range(array(shp1.zorderposition, shp2.zorderposition)).mergeshapes(msomergecombine) end sub
Comments
Post a Comment