在 Powerpoint 上对齐图片

Align pictures on Powerpoint

我目前正在创建一个宏,它将获取一个 excel 文件并将其内容放入 PowerPoint 中。 我无法对齐刚刚从 excel 复制并粘贴到 PowerPoint 中的图片。下面是我用来粘贴图片并不断收到 "The item with the specified name wasn't found." 错误的代码 我想知道这是否是因为宏是 运行 来自 Excel 而不是 PowerPoint?

     Sheets("Bay du Nord").Range("E3:P9").CopyPicture _
Appearance:=xlScreen, Format:=xlPicture

Slide2.Select
Slide2.Shapes.Paste.Name = "SamplePic"



Set Shp1 = ActiveSheet.Shapes("Textbox 13")
Set shp2 = ActiveSheet.Shapes("SamplePic")

shp2.Top = Shp1.Top

我假设 "TextBox 3" 位于您的幻灯片上,而不是在您的工作表上,并且您希望将粘贴的形状与幻灯片上的 "TextBox 3" 对齐。如果是这样,请尝试以下操作:

Sheets("Bay du Nord").Range("E3:P9").CopyPicture _
    Appearance:=xlScreen, Format:=xlPicture

Set shp1 = Slide2.Shapes("TextBox 3")

With Slide2
    .Shapes.Paste.Name = "SamplePic"
    With .Shapes(.Shapes.Count)
        .Top = shp1.Top
    End With
End With