问题描述
我正在使用VBA的以下行来设置刚粘贴到PowerPoint中的Excel选择的大小/位置:
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
但是,宏运行后,我的形状的左上角水平位置为0.01,左上角垂直方向为" 0.02.根据我的代码,该位置应为0.58和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?
推荐答案
要补充Tim所说的话,PowerPoint至少以自动化为目的,将点作为其测量系统,因此,请执行以下操作:
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
这篇关于使用VBA在PowerPoint中设置对象的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!