Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting an object's position in PowerPoint using VBA

I am using the following lines of VBA to set the size/position of an Excel selection I just pasted into PowerPoint:

Set Shp = _
PPApp.ActivePresentation.Slides( _
PPApp.ActiveWindow.Selection.SlideRange.slideindex).Shapes(3)
Shp.ScaleHeight 0.75, msoCTrue
Shp.ScaleWidth 0.75, msoCTrue
Shp.Left = 0.58
Shp.Top = 1.6

However, after the macro runs, my shape has horizontal position of 0.01" from the top left corner and a vertical position of "0.02" from the top left corner. Based on my code, the position should be 0.58 and 1.6. Any ideas of why the position is not being set properly?

like image 759
user1533277 Avatar asked Dec 24 '13 00:12

user1533277


1 Answers

To add to what Tim's said, PowerPoint uses points as its system of measurement, at least for purposes of automation, so do this instead:

Shp.Left = 0.58 * 72
Shp.Top = 1.6 * 72
like image 83
Steve Rindsberg Avatar answered Nov 10 '22 00:11

Steve Rindsberg