如何使用excel中的powerpoint vba向下移动图像?

时间:2011-09-22 19:22:15

标签: vba powerpoint

我是powerpoint中的vba和宏的新手。将图像定位到-30的正确语法是什么?

PPT.ActiveWindow.View.GotoSlide 9

Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
' Reference active slide
Set PPSlide = PPPres.Slides _
    (PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
' Copy chart as a picture
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, _
    Format:=xlPicture
' Paste chart
PPSlide.Shapes.Paste.Select
' Align pasted chart

Dim xyz As Shape
Set xyz = PPSlide.Shapes.Selection


PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
xyz.Top = xyz.Top - 30

1 个答案:

答案 0 :(得分:1)

<强>已更新

根据您的代码示例,我想您想尝试这样的事情:

 PPSlide.Shapes.Paste.Select
' Align pasted chart

PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
PPApp.ActiveWindow.Selection.ShapeRange(1).Top = PPApp.ActiveWindow.Selection.ShapeRange(1).Top + 30

你可以拿出参考xyz的行。