Hello.
I have a ppt with different shapes. And I have xls file with different tables and charts. My macro is copying different objects from xls to ppt - shape in ppt is replaced by the assigned object from xls.
First I take the shape parameters:
And then paste the object from xls and replace the shape (I delete the shape afterwards)
<select something in xls>
By doing that I can put each table/chart/whatever exactly where I want in ppt. However, there is one thing I cannot do better - the objects size and shape. With my settings, each xls object inherits the size of the ppt shape. What I would like to do is to set up the top left corner (c,d) as the permanent value and then paste the object (with locked aspect ratio) into the shape. The condition is that the object cannot be bigger than a shape (however can be smaller).
This is not a big deal with charts and tables, but it makes things worse with pivot tables - different amount of rows is causing the objects to look bad sometimes when pasted as shape. Is there anything I can change in the code to make it better?
Thanks in advance.
I have a ppt with different shapes. And I have xls file with different tables and charts. My macro is copying different objects from xls to ppt - shape in ppt is replaced by the assigned object from xls.
First I take the shape parameters:
SQL:
Set obj = pppres.Slides(sld(i)).Shapes(crt(i))
a = obj.Height
b = obj.Width
C = obj.Top
d = obj.Left
And then paste the object from xls and replace the shape (I delete the shape afterwards)
<select something in xls>
SQL:
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Set myShapeRange = pppres.Slides(sld(i)).Shapes.Paste
With myShapeRange
.LockAspectRatio = msoFalse
.Left = d
.Top = C
.Width = b
.Height = a
End With
By doing that I can put each table/chart/whatever exactly where I want in ppt. However, there is one thing I cannot do better - the objects size and shape. With my settings, each xls object inherits the size of the ppt shape. What I would like to do is to set up the top left corner (c,d) as the permanent value and then paste the object (with locked aspect ratio) into the shape. The condition is that the object cannot be bigger than a shape (however can be smaller).
This is not a big deal with charts and tables, but it makes things worse with pivot tables - different amount of rows is causing the objects to look bad sometimes when pasted as shape. Is there anything I can change in the code to make it better?
Thanks in advance.