【问题标题】:Setting an object's position in PowerPoint using VBA使用 VBA 在 PowerPoint 中设置对象的位置
【发布时间】:2021-03-04 17:51:31
【问题描述】:

我正在使用以下 VBA 行来设置我刚刚粘贴到 PowerPoint 中的 Excel 选择的大小/位置:

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。关于位置设置不正确的任何想法?

【问题讨论】:

  • 默认单位是Points(72 点=1 英寸)

标签: excel vba powerpoint


【解决方案1】:

补充一下蒂姆所说的,PowerPoint 使用点作为其测量系统,至少出于自动化目的,所以改为这样做:

Shp.Left = 0.58 * 72
Shp.Top = 1.6 * 72

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-11
    • 1970-01-01
    • 2017-08-24
    • 2018-08-24
    相关资源
    最近更新 更多